UNPKG

@shopify/cli-kit

Version:

A set of utilities, interfaces, and models that are common across all the platform features

17 lines (16 loc) 818 B
/** * Perform an action optimistically. If it fails the first time, first initiate * a provided recovery procedure, then retry the action. If it fails again, * throw the error. * * This is useful for actions that may fail due to recoverable errors, such as * an expired token that can be refreshed. In this case, the recovery procedure * would refresh the token. * * @param performAction - The action to perform. * @param recoveryProcedure - The recovery procedure to perform if the action * fails the first time. * @param retries - The number of times to retry the action if an error happens. * @returns The result of the action. */ export declare function performActionWithRetryAfterRecovery<T>(performAction: () => Promise<T>, recoveryProcedure: () => Promise<unknown>, retries?: number): Promise<T>;