Libraries
    Preparing search index...

    Error thrown by the typed HTTP client when the server responds with a non-2xx status code.

    try {
    await client.todos.get({ params: { id: 999 } });
    } catch (err) {
    if (err instanceof ApiError && err.status === 404) {
    console.log('Not found:', err.message);
    }
    }

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • status: number

        The HTTP status code (e.g. 404, 500).

      • message: string

        A human-readable error description.

      • body: unknown = undefined

        The parsed response body, if the server returned JSON.

      Returns ApiError

    Properties

    body: unknown = undefined

    The parsed response body, if the server returned JSON.

    cause?: unknown
    message: string
    name: string
    stack?: string
    status: number

    The HTTP status code (e.g. 404, 500).