import type * as Zod from "zod"; type HttpStatus = number; type HttpStatusText = string; interface BaseFetcherError extends Error { originalError?: Error; toJSON(): Record; } export interface FetcherNetworkError extends BaseFetcherError { type: "NetworkError"; } export interface FetcherAuthorizationError extends BaseFetcherError { type: "AuthorizationError"; status: HttpStatus; statusText: HttpStatusText; reason?: string; data: T; } export interface FetcherRequestError extends BaseFetcherError { type: "RequestError"; status: HttpStatus; statusText: HttpStatusText; reason?: string; data: T; } export interface FetcherServerError extends BaseFetcherError { type: "ServerError"; status: HttpStatus; statusText: HttpStatusText; reason?: string; data: T; } export type FetcherError = FetcherNetworkError | FetcherRequestError | FetcherAuthorizationError | FetcherServerError; export type FetcherErrorType = "NetworkError" | "RequestError" | "ServerError" | "AuthorizationError"; export declare class FetcherNetworkErrorClass extends Error implements FetcherNetworkError { type: "NetworkError"; originalError?: Error; constructor(originalError?: Error); toJSON(): { name: string; message: string; type: "NetworkError"; }; } export declare class FetcherAuthorizationErrorClass extends Error implements FetcherAuthorizationError { originalError?: Error; type: "AuthorizationError"; status: HttpStatus; statusText: HttpStatusText; reason?: string; data: T; constructor(status: HttpStatus, statusText: HttpStatusText, data: T, originalError?: Error); toJSON(): { name: string; message: string; type: "AuthorizationError"; status: number; statusText: string; data: T; reason: string | undefined; }; } export declare class FetcherRequestErrorClass extends Error implements FetcherRequestError { originalError?: Error; type: "RequestError"; status: HttpStatus; statusText: HttpStatusText; reason?: string; data: T; constructor(status: HttpStatus, statusText: HttpStatusText, data: T, originalError?: Error); toJSON(): { name: string; message: string; type: "RequestError"; status: number; statusText: string; data: T; reason: string | undefined; }; } export declare class FetcherServerErrorClass extends Error implements FetcherServerError { originalError?: Error; type: "ServerError"; status: HttpStatus; statusText: HttpStatusText; reason?: string; data: T; constructor(status: HttpStatus, statusText: HttpStatusText, data: T, originalError?: Error); toJSON(): { name: string; message: string; type: "ServerError"; status: number; statusText: string; }; } /** * A transport-agnostic view of a failed request, built by the fetcher from a * `fetch` `Response` (or from a thrown network error, in which case `status` * is `undefined`). Replaces the previous `AxiosError` input so the error * layer no longer depends on Axios. */ export type FetcherErrorInput = { status?: number; statusText?: string; data?: T; originalError?: Error; }; export declare const fromFetcherError: (input: FetcherErrorInput) => Promise>; export declare const determineIfIsFetcherError: (error: unknown) => error is FetcherError; export declare const getErrorWithReasonErrorMessage: (error: unknown, zodSchema: Zod.ZodType>, errorMessages: Record) => string | undefined) | undefined>) => unknown; export {}; //# sourceMappingURL=error.d.ts.map