-
-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Allow onFailedAttempt
to be async
#30
Allow onFailedAttempt
to be async
#30
Conversation
Also aborts all retries if `onFailedAttempt` throws.
@sindresorhus any chance this could be merged? |
onFailedAttempt
to be async
readme.md
Outdated
}, | ||
``` | ||
|
||
If `onFailedAttempt` throws, all retries will be aborted. |
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.
This text and example be added to https://github.com/sindresorhus/p-retry/pull/30/files#diff-0730bb7c2e8f9ea2438b52e419dd86c9R96, not here.
You also need to keep https://github.com/sindresorhus/p-retry/blob/master/index.d.ts in sync.
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.
If
onFailedAttempt
throws, all retries will be aborted.
This needs to mention that the original promise will reject with this error.
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.
I've updated the docs but I'm not sure what changes to make to the .d.ts
file, I don't really know any TypeScript, sorry.
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.
Just add the docs changes to the .d.ts
file.
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.
I've added the change. Hopefully it's in the right place.
Co-Authored-By: Sindre Sorhus <sindresorhus@gmail.com>
Builds on #29 and adds tests & docs. Also wraps the invocation of
onFailedAttempt
in atry/catch
to avoidunhandledPromiseRejection
s if it throws.Fixes #27.