Files
Checkmate/server/src/utils/AppError.ts
T
2026-03-12 11:12:46 -07:00

25 lines
641 B
TypeScript

export interface AppErrorConfig {
message?: string;
status?: number;
service?: string;
method?: string;
details?: Record<string, unknown> | undefined;
}
export class AppError extends Error {
readonly status: number;
readonly service: string;
readonly method: string;
readonly details: Record<string, unknown> | undefined;
constructor({ message, status = 500, service = "unknownService", method = "unknownMethod", details = undefined }: AppErrorConfig) {
super(message);
this.status = status;
this.service = service;
this.method = method;
this.details = details;
Error.captureStackTrace(this, this.constructor);
}
}