jungles-errors

2.0.0 • Public • Published

Jungles Errors

Middleware for dealing with errors. The reason why this isn't an app you can mount is because apps can't catch errors from other apps (bug?). This also should be last in the Express stack so it can catch 404s.

API

require('jungles-errors')(/* your express app */, /* optional path to custom error view */);

Mount

var app = express();
require('jungles-errors')(app, __dirname + '/template.jade'); // template.jade string is optional.

Throw errors

If the type is 'http' the correct response code is set.

next({ type: 'http', error: 404 });

If the type isn't 'http' a 500 Internal Server Error is shown.

next({ type: 'database', error: 'Connection problems' });

Readme

Keywords

none

Package Sidebar

Install

npm i jungles-errors

Weekly Downloads

0

Version

2.0.0

License

none

Last publish

Collaborators

  • enome