UNPKG

extendable-http-errors

Version:

Extendable http error for node server using es2015, covers most HTTP default errors and allow extending them for custom errors.

11 lines (8 loc) 280 B
const _ = require('lodash'); const httpErrors = require('../http-errors'); module.exports = (userCustomErrors = {}) => { _.extend(httpErrors, userCustomErrors); _.each(httpErrors, (CustomHttpError, errorName) => { global[errorName] = CustomHttpError; }); };