Runs fn, retrying it with exponential backoff while it throws a retryable error.
The delay before retry n (0-based) is min(maxMs, baseMs * 2 ** n), optionally with full
jitter. A non-retryable error (per RetryOptions.retryable) is rethrown immediately,
as is the last error once attempts is exhausted.
// retry the connect up to 4 times on transient network errors; a bad password fails at once constssh = awaitretry(() =>connect({ hostname:'box', username:'u', password:pw }), { attempts:4 });
Runs
fn, retrying it with exponential backoff while it throws a retryable error.The delay before retry
n(0-based) ismin(maxMs, baseMs * 2 ** n), optionally with full jitter. A non-retryable error (per RetryOptions.retryable) is rethrown immediately, as is the last error onceattemptsis exhausted.