/** * `openapi-fetch` resolves both outcomes of a request into `{ data, error }`, * so a 404 is a fulfilled promise. TanStack Query only treats a *rejected* * query function as a failure, so the query layer has to convert one into the * other. This is the carrier for that conversion: it keeps the HTTP status and * the parsed error body instead of flattening the failure to a message string. */ export declare class HttpRequestError
extends Error { readonly name = "HttpRequestError"; /** Lowercase OpenAPI method (`get`, `post`, …) that failed. */ readonly method: string; /** The OpenAPI path template, braces intact (`/users/{id}`). */ readonly path: string; readonly status: number; readonly statusText: string; /** * The response body parsed by `openapi-fetch`, typed from the operation's * error responses — and `| undefined`, because a failure need not have one: a * 5xx from a proxy, or any non-2xx with an empty body, leaves nothing to * parse. Declaring it as `TBody` alone would let a consumer read through to a * property of a body that is not there. */ readonly body: TBody | undefined; readonly response: Response; constructor(init: { method: string; path: string; body: TBody | undefined; response: Response; }); } /** * What {@link isHttpRequestError} narrows `TValue` to: the `HttpRequestError` * member `TValue` already declares, so the body type the operation described * survives the guard, and a bare `HttpRequestError` when `TValue` declares none * — a `catch` binding, where no body type is knowable. */ type NarrowedHttpRequestError