Repository navigation
Releases
Releases · sindresorhus/p-retry
v9.0.0
Breaking
- Once
signalis aborted, the promise always rejects with the abort reason and no more callbacks are called dff55ff 1d8bd87 62d4a51- Before, if the abort came during an attempt or a callback,
shouldConsumeRetry,onFailedAttempt, andshouldRetrycould still run. The promise could also reject with the operation's error instead of the abort reason. - The abort reason now also wins over an
AbortErrorthrown by the operation.
- Before, if the abort came during an attempt or a callback,
shouldConsumeRetryreturning nothing now counts astruee80456b- Before, a callback that forgot to
returnmade failures skip theretriesbudget, so retries never ran out.
- Before, a callback that forgot to
- Validate the
randomize,unref, andsignaloptions e80456b dff55ffrandomizeandunrefmust be booleans, andsignalmust be anAbortSignal. Other values now throw aTypeError.
Improvements
- Make the
messageargument ofAbortErroroptional 62d4a51 - Keep the
thistype of the function passed tomakeRetriable2f34d75 - Allow explicitly passing
undefinedfor options when usingexactOptionalPropertyTypes2f34d75
Fixes
- Fix very long retry delays firing immediately 4100a6d
setTimeoutruns a delay above 2147483647ms (about 24.9 days) right away. Delays are now capped at that value.
- Fix
NaNretry delay whenminTimeoutis0andfactorgrows toInfinity4100a6d - Fix a nested
AbortErrorescaping instead of its cause dff55ff - Fix a thrown value that cannot be stringified replacing the real failure 9ba0763
- Fix the stack of the error wrapped by
AbortError00a53aa 33d5e2b- It now has the correct message and starts at the caller instead of inside p-retry.
- Call
shouldConsumeRetryalso whenmaxRetryTimehas run out, so the callbacks always run in the documented order bd5d4a8 - Report
retryDelay: 0for aTypeErrorthat is never retried 127e14e
v8.0.1
v8.0.0
Breaking
- Require Node.js 22 85cdece
- Change retry callback order 616306e
- Callback order changed from
onFailedAttempt→shouldConsumeRetry→shouldRetrytoshouldConsumeRetry→onFailedAttempt→shouldRetry. - Consumption decisions are now made before failure notifications and retry decisions.
- Callback order changed from
Improvements
- Add
retryDelaytoonFailedAttemptcontext (#66) 96cce98 - Fix
TypeErrorretry handling f011d2e - Harden retry timing and callback validation 9d47b60
v7.1.1
v7.1.0
v7.0.0
Breaking
- Require Node.js 20 3bdb53a
onFailedAttemptandshouldRetrynow receive acontextobject instead of a decoratederrorbff36bb- You must now must access the error as
object.errorinstead ofobject. - The use of
.attemptNumberand.retriesLeftdid not change.
- You must now must access the error as
- Remove the
foreveroption (#79) 6a89827- Many use-cases can use
{retries: Infinity}instead for infinite retries.
- Many use-cases can use
Improvements
- Rewrite the package to not depend on the
retrypackage (#79) 6a89827- This is a full rewrite, so test carefully.
- Add
makeRetriablemethod 1a81c1e
v7.0.0-0
Breaking
- Require Node.js 20 3bdb53a
onFailedAttemptandshouldRetrynow receive acontextobject instead of a decoratederrorbff36bb- You must now must access the error as
object.errorinstead ofobject. - The use of
.attemptNumberand.retriesLeftdid not change.
- You must now must access the error as
- Remove the
foreveroption (#79) 6a89827- Many use-cases can use
{retries: Infinity}instead for infinite retries.
- Many use-cases can use
Improvements
- Rewrite the package to not depend on the
retrypackage (#79) 6a89827- This is a full rewrite, so test carefully.
- Add
makeRetriablemethod 1a81c1e
v6.2.1
v6.2.0
- Add
shouldRetryoption (#75) b993a96
v6.1.0
- Move network error detection into a separate package ba073f3