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

Don't error when trying to extend non-extensible errors #83

Closed
wants to merge 1 commit into from

Conversation

airhorns
Copy link

@airhorns airhorns commented Nov 16, 2024

Before this change, pRetry blindly tries to modify the error thrown by the inner function. If that error happens to not be an extensible object, this modification itself throws, which aborts the retry chain and obscures the inner error. This change makes pRetry not add these properties if the error object can't be extended under the presumption that retrying this error is better than hard erroring the first time its thrown.

Fixes #25

Before this change, `pRetry` blindly tries to modify the error thrown by the inner function. If that error happens to not be an extensible object, this modification itself throws, which obscures the inner error. This change makes `pRetry` not add these properties if the error object can't be extended under the presumption that retrying this error is better than hard erroring the first time its thrown.

Fixes sindresorhus#25
@airhorns airhorns closed this Nov 17, 2024
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.

Non-extensible rejections result in unhandled rejection
1 participant