http-errors-enhanced
Version:
Create HTTP errors with additional properties for any framework.
20 lines (19 loc) • 779 B
TypeScript
import { type GenericObject } from './utils.js';
export declare class HttpError extends Error {
static standardErrorPrefix: string;
status: number;
statusCode: number;
statusClass: number;
code: string;
error: string;
errorPhrase: string;
expose: boolean;
headers: Record<string, string>;
isClientError: boolean;
isServerError: boolean;
[key: string]: any;
constructor(status: number | string, message?: string | GenericObject, properties?: GenericObject);
serialize(extended?: boolean, omitStack?: boolean): object;
}
export declare function createError(status: number | string, message?: string | GenericObject, properties?: GenericObject): HttpError;
export declare function isHttpError(error: any): error is HttpError;