Skip to content

Releases

v9.0.0

Choose a tag to compare

@sindresorhus sindresorhus released this 02 Nov 20:42

Breaking

  • Once signal is 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, and shouldRetry could 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 AbortError thrown by the operation.
  • shouldConsumeRetry returning nothing now counts as true e80456b
    • Before, a callback that forgot to return made failures skip the retries budget, so retries never ran out.
  • Validate the randomize, unref, and signal options e80456b dff55ff
    • randomize and unref must be booleans, and signal must be an AbortSignal. Other values now throw a TypeError.

Improvements

  • Make the message argument of AbortError optional 62d4a51
  • Keep the this type of the function passed to makeRetriable 2f34d75
  • Allow explicitly passing undefined for options when using exactOptionalPropertyTypes 2f34d75

Fixes

  • Fix very long retry delays firing immediately 4100a6d
    • setTimeout runs a delay above 2147483647ms (about 24.9 days) right away. Delays are now capped at that value.
  • Fix NaN retry delay when minTimeout is 0 and factor grows to Infinity 4100a6d
  • Fix a nested AbortError escaping 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 AbortError 00a53aa 33d5e2b
    • It now has the correct message and starts at the caller instead of inside p-retry.
  • Call shouldConsumeRetry also when maxRetryTime has run out, so the callbacks always run in the documented order bd5d4a8
  • Report retryDelay: 0 for a TypeError that is never retried 127e14e

v8.0.1...v9.0.0

v8.0.1

Choose a tag to compare

@sindresorhus sindresorhus released this 01 Sep 13:14
  • Fix error for invalid fractional retry counts 3c22035

v8.0.0...v8.0.1

v8.0.0

Choose a tag to compare

@sindresorhus sindresorhus released this 26 Mar 16:09

Breaking

  • Require Node.js 22 85cdece
  • Change retry callback order 616306e
    • Callback order changed from onFailedAttempt → shouldConsumeRetry → shouldRetry to shouldConsumeRetry → onFailedAttempt → shouldRetry.
    • Consumption decisions are now made before failure notifications and retry decisions.

Improvements


v7.1.1...v8.0.0

v7.1.1

Choose a tag to compare

@sindresorhus sindresorhus released this 09 Dec 21:15
  • Fix delayed abort when signal is already aborted before delay phase 2aba573

v7.1.0...v7.1.1

v7.1.0

Choose a tag to compare

@sindresorhus sindresorhus released this 09 Oct 02:57

v7.0.0

Choose a tag to compare

@sindresorhus sindresorhus released this 21 Aug 10:23

Breaking

  • Require Node.js 20 3bdb53a
  • onFailedAttempt and shouldRetry now receive a context object instead of a decorated error bff36bb
    • You must now must access the error as object.error instead of object.
    • The use of .attemptNumber and .retriesLeft did not change.
  • Remove the forever option (#79) 6a89827
    • Many use-cases can use {retries: Infinity} instead for infinite retries.

Improvements


v6.2.1...v7.0.0

v7.0.0-0

v7.0.0-0 Pre-release
Pre-release

Choose a tag to compare

@sindresorhus sindresorhus released this 06 May 14:54

Breaking

  • Require Node.js 20 3bdb53a
  • onFailedAttempt and shouldRetry now receive a context object instead of a decorated error bff36bb
    • You must now must access the error as object.error instead of object.
    • The use of .attemptNumber and .retriesLeft did not change.
  • Remove the forever option (#79) 6a89827
    • Many use-cases can use {retries: Infinity} instead for infinite retries.

Improvements


v6.2.1...v7.0.0-0

v6.2.1

Choose a tag to compare

@sindresorhus sindresorhus released this 15 Nov 05:48
  • Fix onFailedAttempt and shouldRetry options being undefined (#82) b400af6

v6.2.0...v6.2.1

v6.2.0

Choose a tag to compare

@sindresorhus sindresorhus released this 20 Dec 20:39

v6.1.0

Choose a tag to compare

@sindresorhus sindresorhus released this 26 Sep 14:18

v6.0.0...v6.1.0