UNPKG

@icapps/tree-house-errors

Version:

NodeJS default error definitions with an error parser utility function

19 lines (18 loc) 660 B
import { ApiError, ErrorType } from './errors'; export declare const isJsonApiError: (obj?: ParsedError | any) => obj is ParsedError; export declare const isApiError: (err: ApiError | any, type?: ErrorType) => err is ApiError<any>; export declare function parseErrors(error?: any, translatorOptions?: TranslatorOptions): ParsedError; export declare function parseJsonErrors(response: any): ApiError[]; export interface TranslatorOptions { path: string; defaultLocale?: string; language?: string; } export interface ParsedError { id: string; status: number; code: string; title: string; detail: any; meta: any | undefined; }