EvalueTonSavoir/server/middleware/AppError.js

10 lines
319 B
JavaScript
Raw Permalink Normal View History

2024-03-29 20:08:34 -04:00
class AppError extends Error {
2025-02-09 16:10:25 -05:00
constructor(errorCode = { message: "Something went wrong", code: 500 }) {
super(errorCode.message);
this.statusCode = errorCode.code || 500;
this.isOperational = true;
Error.captureStackTrace(this, this.constructor);
2024-03-29 20:08:34 -04:00
}
}
2025-02-09 16:10:25 -05:00
module.exports = AppError;