3.1.0 • Published 2 years ago

@mapbox/mapbox-error v3.1.0

Weekly downloads
881
License
ISC
Repository
github
Last release
2 years ago

Build Status

Generic error middleware for express.js apps

usage:

const errors = require('@mapbox/mapbox-error');
const ErrorHTTP = errors.ErrorHTTP;
const server = require('express')();

// use ErrorHTTP to associate a status code and message to an Error object
server.get('/error', (req, res, next) => {
  return next(new ErrorHTTP('Error for the sake of errors', 400));
});

// put these after other routes and uses have been defined
server.use(errors.showError);
server.use(errors.notFound);

test:

npm test

3.1.0

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.1.0-dev3

4 years ago

3.1.0-dev2

4 years ago

4.0.0-dev2

4 years ago

4.0.0-dev

4 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.3.0-dev1

6 years ago