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.

      • message: string = DEFAULT_TIMEOUT_MESSAGE

        The message to set in the TimeoutError.

      • origin: string = ErrorOrigin.INTERNAL

        The error origin. (default: ErrorOrigin.INTERNAL)

      • level: ErrorLevel = ErrorLevel.FATAL

        The error level (default: ErrorLevel.FATAL)

      Returns Promise<T>