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 constructor public #1657

Merged

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.

@fatroom fatroom added the minor Minor changes, e.g. low risk config updates, changes that do not introduce a new API call. label Nov 6, 2024
@fatroom
Copy link
Member

fatroom commented Nov 6, 2024

@puncleV than you for this suggestion. Can you please describe a sample use-case related to this change in the https://github.com/zalando/riptide/blob/main/riptide-failsafe/README.md ?

@puncleV puncleV force-pushed the make-retry-exception-constructor-public branch from 9cb5da7 to 4651ab3 Compare November 6, 2024 15:49
@puncleV
Copy link
Contributor Author

puncleV commented Nov 6, 2024

@fatroom yes, no problem, was fighting with gpg key to sign the commit. :D

@puncleV
Copy link
Contributor Author

puncleV commented Nov 7, 2024

@fatroom ca62cc6 also added a test case for autoconfigure

@fatroom
Copy link
Member

fatroom commented Nov 7, 2024

@puncleV can you merge main branch here to pickup dependency changes?

@puncleV
Copy link
Contributor Author

puncleV commented Nov 7, 2024

@fatroom done

@fatroom
Copy link
Member

fatroom commented Nov 7, 2024

Thank you for your contribution!

@fatroom fatroom merged commit 10f0109 into zalando:main Nov 7, 2024
2 of 4 checks passed
@puncleV puncleV deleted the make-retry-exception-constructor-public branch November 7, 2024 18:17
@puncleV
Copy link
Contributor Author

puncleV commented Nov 7, 2024

Thank you for your contribution!

First of many! (Or at least few more, maybe…) :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Minor changes, e.g. low risk config updates, changes that do not introduce a new API call.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants