mirror of
https://github.com/kevin-DL/complete-node-bootcamp.git
synced 2026-01-12 03:15:12 +00:00
14 lines
312 B
JavaScript
14 lines
312 B
JavaScript
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;
|