err-http

Error constructors for common http error types

Usage no npm install needed!

<script type="module">
  import errHttp from 'https://cdn.skypack.dev/err-http';
</script>

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!'));
});