Skip to content

Commit

Permalink
chore(server): inline comment re internal server error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Mar 17, 2023
1 parent 3f623f0 commit d5d579f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ async function plugin(server, config) {

// Errors thrown by routes and plugins are caught here
.setErrorHandler(async (err, _req, res) => {
/**
* Catch 5xx errors, log them, and return a generic 500
* response. This avoids leaking internal server error details
* to the client
*/
if (
(err.statusCode >= 500 &&
/* istanbul ignore next: under-pressure plugin throws valid 503s */
Expand Down

0 comments on commit d5d579f

Please sign in to comment.