fexios
Version:
Fetch based HTTP client with similar API to axios for browser and Node.js
37 lines (36 loc) • 1.24 kB
TypeScript
import { FexiosContext, IFexiosResponse } from './types';
/**
* Error codes for Fexios
*/
export declare enum FexiosErrorCodes {
BODY_USED = "BODY_USED",
NO_BODY_READER = "NO_BODY_READER",
TIMEOUT = "TIMEOUT",
NETWORK_ERROR = "NETWORK_ERROR",
BODY_NOT_ALLOWED = "BODY_NOT_ALLOWED",
HOOK_CONTEXT_CHANGED = "HOOK_CONTEXT_CHANGED",
ABORTED_BY_HOOK = "ABORTED_BY_HOOK",
INVALID_HOOK_CALLBACK = "INVALID_HOOK_CALLBACK",
UNEXPECTED_HOOK_RETURN = "UNEXPECTED_HOOK_RETURN"
}
/**
* Base Fexios error class
*/
export declare class FexiosError extends Error {
readonly code: FexiosErrorCodes | string;
readonly context?: FexiosContext | undefined;
name: string;
constructor(code: FexiosErrorCodes | string, message?: string, context?: FexiosContext | undefined, options?: ErrorOptions);
}
/**
* Fexios response error class for HTTP errors
*/
export declare class FexiosResponseError<T> extends FexiosError {
readonly response: IFexiosResponse<T>;
name: string;
constructor(message: string, response: IFexiosResponse<T>, options?: ErrorOptions);
}
/**
* Check if the error is a FexiosError that not caused by Response error
*/
export declare const isFexiosError: (e: any) => boolean;