retry
retry<
T>(params):Promise<T>
Defined in: async/retry/index.ts:24
Retries an async function with configurable backoff strategy.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”params
Section titled “params”RetryParams<T>
The parameters object
Returns
Section titled “Returns”Promise<T>
The result of the first successful call
Example
Section titled “Example”const data = await retry({ fn: () => fetch("/api"), attempts: 5, backoff: "exponential" });Keywords
Section titled “Keywords”retry on failure, exponential backoff, resilient call, auto retry
Throws
Section titled “Throws”Error if fn is not a function
Throws
Section titled “Throws”The last error if all attempts fail