AniLink - v3.1.0
    Preparing search index...

    Class AniLinkRestError

    A REST-level failure returned by a REST-style provider.

    REST APIs report failures as plain HTTP status codes with a JSON (or HTML) body rather than inside a GraphQL envelope, so this subclass exists to give consumers a stable type to branch on without inspecting status codes. It carries no additional fields beyond AniLinkApiError; its value is the named type itself plus the distinct AniLinkErrorCodes.REST code, so consumers can classify REST-provider failures by code alone, without an instanceof check.

    Hierarchy (View Summary)

    Index
    • Creates a REST error carrying the upstream HTTP status and body.

      Parameters

      • status: number

        The HTTP status returned by the upstream REST API.

      • data: unknown

        The response body returned by the upstream REST API.

      • OptionalrawAxiosError: unknown

        The original Axios error when raw diagnostics are enabled.

      • Optionaloptions: { contentType?: string; rateLimit?: RateLimitInfo; requestId?: string }

        Additional error metadata such as rate-limit headers, the response content type, and the request correlation ID.

      Returns AniLinkRestError

    Stable code used to classify the failure.

    contentType?: string

    The Content-Type of the failing response, parsed from the upstream response headers. REST providers such as MyAnimeList return HTML or plain-text bodies on rate-limit and gateway error paths; this field lets consumers distinguish a structured JSON failure payload (where data.message is meaningful) from a non-JSON one without guessing. Absent when the response carried no Content-Type header.

    data: unknown

    Response body returned by the upstream API, preserved verbatim.

    rateLimit?: RateLimitInfo

    Rate-limit accounting parsed from the x-ratelimit-limit, x-ratelimit-remaining, and x-ratelimit-reset response headers, whenever AniList includes all three. Use it to self-throttle before the next request instead of waiting for another 429. It is never included in the error message so logs stay clean.

    rawAxiosError?: unknown

    Original Axios or transport error when raw diagnostics were enabled.

    requestId?: string

    Library-generated correlation ID joining this failure to the onRequestStart/onResponse/onRetry/onError hook events it produced, so a caught error can be matched to its lifecycle stream in a metrics or logging backend. Absent on errors raised outside the request pipeline (for example validation errors thrown before any request is sent).

    status: number

    HTTP status returned by the upstream API. For GraphQL failures this is the upstream GraphQL error status when available, and the HTTP envelope status (200) otherwise.