UNPKG

@aptly-as/types

Version:
33 lines (32 loc) 1.11 kB
import { AptlyErrorCode } from './error.utils.js'; export interface AptlyErrorBody { name: 'AptlyError'; status: number; message: string; id?: string; code?: AptlyErrorCode; detail?: string; errors?: AptlyErrorBodySimple[]; link?: string; title?: string; error?: string; } export type AptlyErrorBodySimple = Pick<AptlyErrorBody, 'status' | 'message' | 'detail' | 'link'>; export declare class AptlyError extends Error { readonly data: Omit<AptlyErrorBody, 'name'>; readonly error?: Error | undefined; readonly name = "AptlyError"; readonly _status: number; id: string; static fromFetchResponse(response: Response): Promise<AptlyError>; static fromResponse(response: Response): Promise<AptlyError>; constructor(data: Omit<AptlyErrorBody, 'name'>, error?: Error | undefined); get status(): number; get title(): string; get code(): AptlyErrorCode | undefined; get detail(): string | undefined; get link(): string | undefined; get errors(): AptlyErrorBodySimple[]; toJSON(): AptlyErrorBody; toString(): string; }