@book000/pixivts - v0.61.1
    Preparing search index...

    Type Alias PixivError

    PixivError:
        | { retryAfter: number; type: "rate_limit" }
        | { status: number; type: "auth_failed" }
        | { cause: unknown; type: "network" }
        | { body: unknown; status: number; type: "api_error" }

    Discriminated union of all errors that can occur when using the pixiv API client.

    Use the type field to discriminate:

    if (result.isErr) {
    const err = result.error
    if (err.type === 'rate_limit') { ... }
    }

    Type Declaration

    • { retryAfter: number; type: "rate_limit" }
      • retryAfter: number

        Retry-After duration parsed from the last 429 response (milliseconds).

      • type: "rate_limit"

        The request hit the rate limit and exhausted all retries.

    • { status: number; type: "auth_failed" }
      • status: number

        HTTP status code (always 401).

      • type: "auth_failed"

        Authentication failed (401 response that could not be refreshed).

    • { cause: unknown; type: "network" }
      • cause: unknown

        The underlying error thrown by fetch.

      • type: "network"

        A network-level error occurred (fetch threw).

    • { body: unknown; status: number; type: "api_error" }
      • body: unknown

        Parsed response body (object if JSON, string otherwise).

      • status: number

        HTTP status code.

      • type: "api_error"

        The API returned a non-2xx status code other than 401/429.