fix(errors): Filter out handled errors from rollbar (#17368)

Give me my inbox back!!
This commit is contained in:
Stuart Taylor
2018-06-01 18:07:28 +01:00
committed by mrugesh mohapatra
parent 1478f4c1ed
commit b2276fe807

View File

@ -34,8 +34,16 @@ export default function errrorReporter() {
}; };
} }
return (err, req, res, next) => { return (err, req, res, next) => {
// handled errors do not need to be reported,
// they report a message and maybe redirect the user
// errors with status codes shouldn't be reported
// as they are usually user messages
if (isHandledError(err) || err.statusCode || err.status) {
return next(err);
}
// logging the error provides us with more information,
// i.e isAuthenticatedUser, req.route
console.error(errTemplate(err, req)); console.error(errTemplate(err, req));
rollbar.error(err.message, err); return rollbar.error(err.message, err);
next(err);
}; };
} }