Add emailing on server exceptions
Keymetrics VC's are coming. They no longer let you see reported errors or notify you on their free tier which renders the service useless for us. This will emailing you using mandrill with a stack trace and context of the error when it receives it
This commit is contained in:
@@ -4,5 +4,17 @@ export default function keymetrics() {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
return (err, req, res, next) => next(err);
|
||||
}
|
||||
return pmx.expressErrorHandler();
|
||||
return (err, req, res, next) => {
|
||||
if (res.statusCode < 400) { res.statusCode = 500; }
|
||||
|
||||
err.url = req.url;
|
||||
err.component = req.url;
|
||||
err.action = req.method;
|
||||
err.params = req.body;
|
||||
err.session = req.session;
|
||||
err.username = req.user ? req.user.username : 'anonymous';
|
||||
err.userId = req.user ? req.user.id : 'anonymous';
|
||||
|
||||
return next(pmx.notify(err));
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user