chatbridge/server/errors/appError.ts

12 lines
344 B
TypeScript
Raw Normal View History

2023-07-24 23:15:27 +00:00
export default class AppError extends Error {
status: string;
isOperational: boolean;
constructor(public statusCode: number = 500, public message: string) {
super(message);
this.status = `${statusCode}`.startsWith('4') ? 'fail' : 'error';
this.isOperational = true;
Error.captureStackTrace(this, this.constructor);
}
}