Function: withRetry()
withRetry<
T
>(operation
: () =>Promise
<T
>,options
: {delayMs?
:number
;maxRetries?
:number
;onError?
: (error
:unknown
,attempt
:number
) =>void
;operationName?
:string
; }):Promise
<T
>
Defined in: electron/utils/retry.ts:48
Generic retry utility with configurable parameters.
Type Parameters
T
T
The return type of the async operation
Parameters
operation
() => Promise
<T
>
The async operation to retry
options
Retry configuration options
delayMs?
number
maxRetries?
number
onError?
(error
: unknown
, attempt
: number
) => void
operationName?
string
Returns
Promise
<T
>
Promise that resolves with the operation result
Remarks
Executes the provided operation with automatic retry logic on failure. Uses a simple delay between retries (not exponential backoff) for predictable timing. Collects all errors and reports them if all retries fail.
Throws
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Error if all retry attempts fail