An error thrown when a timeout occurs

try {
let result = await timeout(fetch("https://example.com"), { ms: 100 });
} catch (error) {
if (error instanceof TimeoutError) {
// Handle timeout
}
}

Hierarchy

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string
prepareStackTrace?: (err: Error, stackTraces: CallSite[]) => any

Optional override for formatting stack traces

stackTraceLimit: number

Methods

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • OptionalconstructorOpt: Function

    Returns void

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • OptionalconstructorOpt: Function

    Returns void