Function retryNetworkOperation

  • Retries a network operation run in a callback.

    Type Parameters

    • T

    Parameters

    • maxAttempts: number

      maximum attempts to try

    • callback: () => Promise<T>

      callback that returns a promise of the network operation. If rejected with ConnectionError, it will be retried by calling the callback again.

    Returns Promise<T>

    the result of the network operation

    ConnectionError If after maxAttempts the callback still throws ConnectionError