Function withBoundedRetry

  • Runs fn, trying again on an error isTransient accepts, with a doubling delay, until the tries or the deadline run out. Any failure that ends the loop is thrown as a SpendMeterUnavailableError carrying the last error.

    Type Parameters

    • T

    Parameters

    • fn: (() => Promise<T>)
        • (): Promise<T>
        • Returns Promise<T>

    • policy: SpendRetryPolicy
    • isTransient: ((e) => boolean)
        • (e): boolean
        • Parameters

          • e: unknown

          Returns boolean

    Returns Promise<T>