import { FetchResponse } from "../types"; /** * Kinto server error code descriptors. */ declare const ERROR_CODES: { 104: string; 105: string; 106: string; 107: string; 108: string; 109: string; 110: string; 111: string; 112: string; 113: string; 114: string; 115: string; 116: string; 117: string; 121: string; 122: string; 201: string; 202: string; 999: string; }; export default ERROR_CODES; declare class NetworkTimeoutError extends Error { url: string; options: Object; constructor(url: string, options: Object); } declare class UnparseableResponseError extends Error { status: number; response: FetchResponse; stack?: string; error: Error; constructor(response: FetchResponse, body: string, error: Error); } export interface ServerResponseObject { code: number; errno: keyof typeof ERROR_CODES; error: string; message: string; info: string; details: unknown; } /** * "Error" subclass representing a >=400 response from the server. * * Whether or not this is an error depends on your application. * * The `json` field can be undefined if the server responded with an * empty response body. This shouldn't generally happen. Most "bad" * responses come with a JSON error description, or (if they're * fronted by a CDN or nginx or something) occasionally non-JSON * responses (which become UnparseableResponseErrors, above). */ declare class ServerResponse extends Error { response: FetchResponse; data?: ServerResponseObject; constructor(response: FetchResponse, json?: ServerResponseObject); } export { NetworkTimeoutError, ServerResponse, UnparseableResponseError };