mirror of
https://github.com/kevin-DL/complete-node-bootcamp.git
synced 2026-01-14 04:04:41 +00:00
Initial commit 🚀
This commit is contained in:
13
4-natours/after-section-09/utils/appError.js
Normal file
13
4-natours/after-section-09/utils/appError.js
Normal file
@@ -0,0 +1,13 @@
|
||||
class AppError extends Error {
|
||||
constructor(message, statusCode) {
|
||||
super(message);
|
||||
|
||||
this.statusCode = statusCode;
|
||||
this.status = `${statusCode}`.startsWith('4') ? 'fail' : 'error';
|
||||
this.isOperational = true;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AppError;
|
||||
Reference in New Issue
Block a user