Amazon Vinyl
    Preparing search index...

    Function withTimeout

    • Races a promise with a timeout, rejecting with a TimeoutError if the timeout is reached before the provided promise.

      Type Parameters

      • T

      Parameters

      • promise: PromiseLike<T>

        The promise to race against a timeout.

      • Optionaltime: number

        The number of seconds to wait. If undefined, the promise is returned without wrapping.

      • options: WithTimeoutOptions = {}

        Timeout error options (message, origin, level).

      Returns Promise<T>