-
Notifications
You must be signed in to change notification settings - Fork 14
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 (currently only function) #123
retry: add predicate option (currently only function) #123
Conversation
Predicate function is executed with rejection value, if the call returns a truthy value then the handler is retried, otherwise the promise is rejected with the original rejection value
partially addresses #122 @suguru03 I decided to implement only the predicate function at first since I need this functionality immediately Regarding implementing the interface based on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Thanks! |
@adrian-gierakowski I will fix a travis issue tomorrow. |
Amazing. Thank you for fast response.
Let me know what you think about what I wrote regarding implementing the
assert interface.
On Tue, 14 Apr 2020 at 08:36, Suguru Motegi ***@***.***> wrote:
@adrian-gierakowski <https://github.com/adrian-gierakowski>
I published it on 1.15.0-alpha.0.
You should be able to install it using npm install ***@***.*** 🙂
I will fix a travis issue tomorrow.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#123 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACQTQNNTWPRNGZGII3QNHDRMQG6LANCNFSM4MG3HLRQ>
.
--
Adrian Gierakowski
|
@adrian-gierakowski Sorry for the late reply! I'm thinking about something like this, class CustomError extends Error {}
const errorRetry = new CustomError('retry');
// instance
const retryOpts = { limit, predicate: errorRetry };
// or class?
const retryOpts = { limit, predicate: CustomError };
return Aigle.retry(retryOpts, () => {}); What do you think? 🤔 I usually use |
Looks good. So I'm assuming I'll be ok to use 'assert' module to implement this and it will be shimmed by whatever library you use to create the browser release? |
I would rather add some code than depend on other libraries. I'm also thinking to support Deno in the future. 😄 |
Predicate function is executed with rejection value, if the call returns
a truthy value then the handler is retried, otherwise the promise is
rejected with the original rejection value