Function retry

Recursively retry a function call

  • Type Parameters

    • T

    Parameters

    • fn: (...args: unknown[]) => T

      The function to retry

    • condition: boolean

      Condition based on which the function will be retried. If true, the function will not be retried.

    • error: string | Error

      Error or error message to throw

    • retryCount: number = 2

      Number of times to retry

    Returns T