add error & error handler middleware

This commit is contained in:
X4Lo committed 2024-05-17 11:50:37 +01:00
1 parent c9881b5558
commit 76c4e47a38
8 files changed
+100

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
class CustomError extends Error {
constructor(message) {
super(message);
this.name = this.constructor.name;
Error.captureStackTrace(this, this.constructor);
}
statusCode() {
return 500; // Default to 500 Internal Server Error
}
}
module.exports = CustomError;