diff --git a/packages/shared-lib/src/error.ts b/packages/shared-lib/src/error.ts index 1d54e852..afe5e97f 100644 --- a/packages/shared-lib/src/error.ts +++ b/packages/shared-lib/src/error.ts @@ -52,6 +52,14 @@ export async function ignoreEnoentAsync(fn: () => Promise): Promise Promise) | undefined; + handleError: ((error: unknown) => Promise) | undefined; + retryCount: number; + retryLogger: ((message: string) => void) | undefined; + sleepMilliseconds: number; +} + /** * Retry the given function. * @param func The function to retry. @@ -64,12 +72,12 @@ export async function ignoreEnoentAsync(fn: () => Promise): Promise( func: (failedCount: number) => Promise, { - beforeRetry = undefined as ((error: unknown) => Promise) | undefined, - handleError = undefined as ((error: unknown) => Promise) | undefined, + beforeRetry = undefined, + handleError = undefined, retryCount = 3, - retryLogger = undefined as ((message: string) => void) | undefined, + retryLogger = undefined, sleepMilliseconds = 0, - } + }: RetryOptions ): Promise { let failedCount = 0; for (;;) {