@breautek/storm
Version:
Object-Oriented REST API framework
37 lines (36 loc) • 1.04 kB
TypeScript
import { StatusCode } from './StatusCode';
import { ExitCode } from './ExitCode';
export interface IAdditionalErrorDetails {
[key: string]: any;
}
export interface ILocale {
code: string;
parameters: Record<string, string>;
}
export interface IErrorResponse {
name: string;
message: string;
locale: ILocale;
code: number;
details: IAdditionalErrorDetails;
}
export declare abstract class StormError<TErrorDetails = any> extends Error {
private $details;
constructor(details?: TErrorDetails);
abstract getMessage(): string;
abstract getCode(): number;
/**
* Sends details to the client.
*/
getPublicDetails(): IAdditionalErrorDetails;
/**
* Private details are only logged to the server log.
* They are kept secret from the client.
*/
getPrivateDetails(): TErrorDetails;
getHTTPCode(): StatusCode;
getErrorResponse(): IErrorResponse;
getLocaleCode(): string;
getLocaleParameters(): Record<string, string>;
getExitCode(): ExitCode;
}