old-rod
v1.2.1
Published
Catch errors in your express routes
Downloads
1
Maintainers
Readme
old-rod
The purpose of this package is to simplify error handling in express applications.
var express = require('express');
var rod = require('old-rod');
var app = express();
app.get('/', function () {
throw {
status: 400,
foo: 'bar'
};
});
// cast your line and catch your errors
app.use(rod.cast());
// even supply default properties for errors if you choose
app.use(rod.cast({
name: 'UnexpectedError',
message: 'An unexpected error has occurred'
}));
app.listen(process.env.PORT);