Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(refactor) make RetryException consructor public #1656

Closed
wants to merge 1 commit into from

Conversation

puncleV
Copy link
Contributor

@puncleV puncleV commented Nov 6, 2024

Make RetryException constructor public to allow using it in the code for easily retry whenever it's needed.

Description

The RetryException which is used for default Failsafe retry handling is now package private which prevents the users from easily introduce retries into their code which have specific cases.

Motivation and Context

Use case: i want to be able to retry specific 400 responses but not all of them, right now i have to define my own failsafe plugin or do some extra steps vs. just importing the RetryException and use it where i see fit.

Example on Kotlin:

 on(HttpStatus.Series.CLIENT_ERROR).dispatch(
              Navigators.status(),
              on(HttpStatus.BAD_REQUEST).call(Problem::class.java) { exception ->
                if (someConditionForBadRequestException
                ) {
                  throw RetryException(exception)
                } else {
                  ...
                }
              },
              anyStatus().call(ProblemRoute.problemHandling())
            )
          )

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@puncleV puncleV force-pushed the make-retry-exception-public branch from 3cb3768 to 4173b31 Compare November 6, 2024 15:24
@puncleV puncleV closed this Nov 6, 2024
@puncleV puncleV deleted the make-retry-exception-public branch November 6, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant