mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-26 06:47:17 +10:00
Return empty request and error handlers
In case Sentry is not set up, empty request and error handler functions are returned instead of nulls.
This commit is contained in:
parent
1882e25d00
commit
d46e4cdfc5
2 changed files with 7 additions and 4 deletions
|
|
@ -162,7 +162,7 @@ app.get('*', (req, res) => {
|
|||
});
|
||||
|
||||
// Set error handler. If Sentry is set up, all error responses
|
||||
// (500 and up) will be logged there.
|
||||
// will be logged there.
|
||||
app.use(log.errorHandler());
|
||||
|
||||
app.listen(PORT, () => {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,9 @@ exports.requestHandler = () => {
|
|||
if (SENTRY_DSN) {
|
||||
return Raven.requestHandler();
|
||||
} else {
|
||||
return null;
|
||||
return (req, res, next) => {
|
||||
next();
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -46,7 +48,9 @@ exports.errorHandler = () => {
|
|||
if (SENTRY_DSN) {
|
||||
return Raven.errorHandler();
|
||||
} else {
|
||||
return null;
|
||||
return (err, req, res, next) => {
|
||||
next(err);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -60,7 +64,6 @@ exports.errorHandler = () => {
|
|||
*/
|
||||
exports.error = (e, data) => {
|
||||
if (SENTRY_DSN) {
|
||||
console.log('logging an exception');
|
||||
Raven.captureException(e, { extra: data });
|
||||
} else {
|
||||
console.error(e);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue