1.0.3 • Published 11 months ago

@onibi/errorhandler v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

@onibi/errorhandler

Errorhandler middleware for express.js that catches and transforms HttpError's from the @onibi/errors library.

Usage example

import express from 'express';
import { Http404Error } from '@onibi/errors';
import handler from '@onibi/errorhandler';

let app = express();

app.get('/404', (req, res) => {
    throw new Http404Error();
})

// The errorHandler should always be the last thing added to the express app.
app.use(handler({
    // This should NEVER be true in a production env.
    includeStackTrace: true,  
    // Send a 404 response if there is no error to catch.
    // Set this to false if you want
    generate404: true
}));

app.listen(8080);
1.0.2

11 months ago

1.0.3

11 months ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.0

2 years ago