Handle sentry config and express routing/page handling errors, to do: handle uncaughtExceptions

parent b33645be
...@@ -35,16 +35,16 @@ for (var routeId in routes) { ...@@ -35,16 +35,16 @@ for (var routeId in routes) {
if (typeof process.env.SENTRY_DSN === 'string' ) { if (typeof process.env.SENTRY_DSN === 'string' ) {
var raven = require('raven'); var raven = require('raven');
app.get( '/sentrythrow', function mainHandler (req,res) { throw new Error('Sentry Test'); } ); app.get( '/sentrythrow', function mainHandler () { throw new Error('Sentry Test'); } );
// These handlers must be applied _AFTER_ other rotes have been applied // These handlers must be applied _AFTER_ other rotes have been applied
app.use( raven.middleware.express.requestHandler( process.env.SENTRY_DSN ) ); app.use( raven.middleware.express.requestHandler( process.env.SENTRY_DSN ) );
app.use( raven.middleware.express.errorHandler( process.env.SENTRY_DSN ) ); app.use( raven.middleware.express.errorHandler( process.env.SENTRY_DSN ) );
app.use( function errorHandler(err, req, res, next) { app.use( function errorHandler (err, req, res, next) {
res.append('X-Sentry-ID:'+res.sentry); res.append('X-Sentry-ID:'+res.sentry);
res.status(500); res.status(500);
next(err); next(err);
} ); } );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment