Skip to content

Commit

Permalink
Merge pull request #399 from HSLdevcom/DT-6025
Browse files Browse the repository at this point in the history
dt-6025 add error logging to error handler
  • Loading branch information
Antiik91 authored Aug 21, 2023
2 parents ee2615c + af915ca commit 206f283
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ app.use((err, req, res, next) => {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};

console.error(
`Request error (${err.response?.status}): ${err.message}
url: ${req.url},
operation: ${req.body?.operationName}`
);

// render the error page
res.status(err.status || err.response?.status || 500).send(err.message);
Expand Down

0 comments on commit 206f283

Please sign in to comment.