expressjs / Api Error Handler
Licence: mit
Express error handlers for JSON APIs
Stars: ✭ 93
Programming Languages
javascript
184084 projects - #8 most used programming language
api-error-handler
An error handler for JSON APIs, meant to be used with http-errors-style errors.
Example
var errorHandler = require('api-error-handler');
var api = new express.Router();
api.get('/users/:userid', function (req, res, next) {
});
api.use(errorHandler());
app.use('/api', api);
API
.use(errorHandler([options]))
Currently no options.
Errors
4xx errors are exposed to the client. Properties exposed are:
message
type
name
code
status
5xx errors are not exposed to the client.
Instead, they are given a generic message
as well as the type
.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].