freshyo/apps/backend/src/lib/api-error.ts
2026-01-24 00:13:15 +05:30

14 lines
No EOL
358 B
TypeScript
Executable file

export class ApiError extends Error {
public statusCode: number;
public details?: any;
constructor(message: string, statusCode: number = 500, details?: any) {
console.log(message)
super(message);
this.name = 'ApiError';
this.statusCode = statusCode;
this.details = details;
Error.captureStackTrace?.(this, ApiError);
}
}