@crumbjs/core
Version:
<img src="https://raw.githubusercontent.com/tuplescompany/crumbjs/refs/heads/main/logo/crumbjs.png" alt="CrumbJS Logo" width="200"/> - The tasty way to build fast apis.
27 lines (26 loc) • 726 B
TypeScript
/**
* Format of all layer exception
*/
export type ExceptionType = {
status: number;
message: string;
fields?: any;
debug?: any;
};
export declare class Exception extends Error {
status: number;
fields?: any | undefined;
raw?: unknown | undefined;
constructor(message: string, status: number, fields?: any | undefined, raw?: unknown | undefined);
getDebug(): any;
toObject(): ExceptionType;
toHtml(): string;
/**
* Convert ExceptionType object to an Exception instance
*/
static from(ex: ExceptionType): Exception;
/**
* Convert any unknown error type to an Exception instance
*/
static parse(error: unknown, statusCode?: number): Exception;
}