Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

err-http

aantthony522MIT1.2.2

Error constructors for common http error types

error, constructor, http, 404, 500, 403

readme

NPM Version NPM Downloads License

err-http

Error constructors for common HTTP error types.

npm install err-http

Usage:

var app = express();

var BadRequestError = require('err-http/badrequest');
var CustomError = require('err-http')('TeapotError', 'I am a teapot', 418);

app.get('/test', function (req, res, next) {
  next(new BadRequestError('Invalid!'));
});