UNPKG

@seasketch/geoprocessing

Version:

Geoprocessing and reporting framework for SeaSketch 2.0

17 lines (16 loc) 907 B
/** * Calls given function and if error thrown, it recursively retries function up to maxTry times, then just rethrows the error * @param fn the function to call * @param args arguments to pass to the function when it is called * @param options.maxTry the maximum number of times to try again, defaults to 3 * @param options.retryCount the current retry count, defaults to 1 * @param options.logEachFailure whether to console.log each failure, defaults to true * @param options.ifErrorContains if provided, retries only if error message includes this string, otherwise rethrows immediatly. * @returns the result of calling the function */ export declare function callWithRetry<T extends (...arg0: any[]) => any>(fn: T, args: Parameters<T>, options?: { maxTry?: number; retryCount?: number; logEachFailure?: boolean; ifErrorMsgContains?: string; }): Promise<Awaited<ReturnType<T>>>;