Skip to content

Type Alias: DebugEvent ​

DebugEvent = { request: Request; type: "request"; } | { attempt: number; request: Request; response: Response; type: "response"; } | { attempt: number; delay: number; reason: "status" | "network"; request: Request; type: "retry"; } | { request: Request; type: "cancel"; }

Defined in: src/types/options.ts:137

A structured event emitted during the request lifecycle when debug is enabled. Each variant carries the data relevant to that stage of the pipeline.

Union Members ​

Type Literal ​

{ request: Request; type: "request"; }

request ​

request: Request

The outgoing request

type ​

type: "request"

Fired before each request attempt, including retries and hook-intercepted requests


Type Literal ​

{ attempt: number; request: Request; response: Response; type: "response"; }

attempt ​

attempt: number

Which attempt number this response came from (1-based)

request ​

request: Request

The originating request

response ​

response: Response

The raw response received

type ​

type: "response"

Fired after fetch() resolves with a response


Type Literal ​

{ attempt: number; delay: number; reason: "status" | "network"; request: Request; type: "retry"; }

attempt ​

attempt: number

1-based number of the retry about to be performed (1 = first retry, i.e. second attempt)

delay ​

delay: number

Delay in milliseconds before the next attempt

reason ​

reason: "status" | "network"

Why the retry was triggered

request ​

request: Request

The originating request

type ​

type: "retry"

Fired when a retry is about to be scheduled


Type Literal ​

{ request: Request; type: "cancel"; }

request ​

request: Request

The request that was cancelled

type ​

type: "cancel"

Fired when the request is cancelled via .cancel() or an AbortController

Released under the MIT License. Built with Claude Code.