AniLink - v3.0.0
    Preparing search index...

    Interface RequestErrorContext

    Context passed to the request lifecycle hooks for a single failed attempt.

    interface RequestErrorContext {
        attempt: number;
        budgetExhausted?: boolean;
        code: AniLinkErrorCode;
        host?: string;
        method: HttpMethod;
        nextDelayMs?: number;
        rateLimit?: RateLimitInfo;
        requestId: string;
        retryAfterMs?: number;
        retryWaitMs?: number;
        status?: number;
        url: string;
    }
    Index
    attempt: number

    The 1-based attempt that failed.

    budgetExhausted?: boolean

    Whether the failure surfaced because the per-window retry budget was exhausted: the failure was retryable, but the window's retry spend was already spent, as opposed to a failure that was never retryable. Present only on the terminal onError report of a budget-gated failure, so hook-based monitoring can detect chronic budget exhaustion (the condition the budget exists to surface) without polling transport-state snapshots.

    The stable code of the normalized failure; see AniLinkErrorCode.

    host?: string

    The upstream host scope the circuit breaker fast-failed for, present on CIRCUIT_OPEN_ERROR error contexts so fast-fail volume can be graphed per upstream directly from onError events.

    method: HttpMethod

    The HTTP method of the request.

    nextDelayMs?: number

    The delay before the next retry, when the failure will be retried.

    rateLimit?: RateLimitInfo

    Rate-limit accounting parsed from the failure response's x-ratelimit-* headers, when the upstream included them.

    requestId: string

    Library-generated correlation ID identifying one logical request across all of its attempts. Use it to join onRequestStart, onResponse, onError, and onRetry events for the same request in a metrics or logging backend.

    retryAfterMs?: number

    Cooldown remaining on the open circuit breaker, in milliseconds, present on CIRCUIT_OPEN_ERROR error contexts while the breaker is open and no probe is pending, the answer to "when can I retry?" in the structured payload instead of the message prose.

    retryWaitMs?: number

    Total time this logical request has spent waiting between attempts (retry backoff and server-dictated delays), accumulated across its attempts. Present only when a wait occurred, the same optional-presence convention as pacedMs on onResponse, so a request that failed after several server-dictated 429 delays stays distinguishable from a fast validation failure in error dashboards without joining onRetry events per requestId.

    status?: number

    The HTTP status when the failure came from an API response.

    url: string

    The URL the request was sent to.