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

.retry: add predicate option, which could be used to decide which errors should trigger a retry #122

Open
adrian-gierakowski opened this issue Apr 11, 2020 · 2 comments

Comments

@adrian-gierakowski
Copy link
Contributor

similar to what's available in bluebird-retry

example usage:

Aigle.retry(
  { predicate: error => error.statesCode === 429 },
  () => requestPromise.get(someUrl)
)

or

Aigle.retry(
  { predicate: MyErrorClass },
  myFunction
)
@suguru03
Copy link
Owner

@adrian-gierakowski Thanks for the idea!
It looks really useful.
I could support a similar syntax as assert.throws or assert.rejects as well. ✍️
https://nodejs.org/api/assert.html#assert_assert_throws_fn_error_message

@adrian-gierakowski
Copy link
Contributor Author

@suguru03 nice idea with using assert interface. I might work on this tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants