Skip to main content

Function: retry()

retry<T>(fn, options?): Promise<T>

Defined in: src/core/utils/retry.ts:100

Retries an async operation with exponential backoff + jitter.

Type Parameters​

T​

T

Parameters​

fn​

() => Promise<T>

Async function to attempt.

options?​

RetryOptions

Retry configuration.

Returns​

Promise<T>

The result of fn on success.

Remarks​

WARNING: retry() is for infrastructure only — config loading, OTel init, bridge injection. Do NOT use for UI interactions — use Playwright's native auto-retry or waitForUI5Stable() instead.

Throws​

The last error after all retries are exhausted.

Example​

const result = await retry(
() => fetchWithTimeout('/api/data'),
{ maxRetries: 3, baseDelay: 200, shouldRetry: (err) => err.message !== 'AUTH_FAILED' },
);