README
app-error-handler
Custom error handler
Usage
npm install app-error-handler
middleware
const appError = require("app-error-handler");
app.use(
appError({
mongooseError: true, // to handle all mongoose errors
sequelizeErrors: true // handle all sequelize errors
})
);
use a custom error
const AppError = require("app-error-habdler/lib/Error");
if (!dummy) {
new AppError("Dummy Message", "DUMMY_CODE", 400);
}