EvalueTonSavoir/server/middleware/AppError.js
2025-02-09 16:10:25 -05:00

10 lines
No EOL
319 B
JavaScript

class AppError extends Error {
constructor(errorCode = { message: "Something went wrong", code: 500 }) {
super(errorCode.message);
this.statusCode = errorCode.code || 500;
this.isOperational = true;
Error.captureStackTrace(this, this.constructor);
}
}
module.exports = AppError;