UNPKG

express-mongo-boilerplate-generator

Version:

A production-ready boilerplate generator for Express.js and MongoDB with service layer architecture and Joi validation

13 lines (10 loc) 319 B
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;