mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-12-26 10:35:04 +03:00
Added a comment to app.js about default express error handler behaviour.
This commit is contained in:
parent
d30fd1cfb2
commit
7da0aae3e9
@ -22,6 +22,14 @@ app.use((err, _req, res, next) => {
|
||||
return res.status(err.statusCode).json({ message: err.message, data: err.data })
|
||||
}
|
||||
|
||||
// This forwards the error to the default express error handler.
|
||||
// As described by expressjs documentation, the default error handler sets response status
|
||||
// to err.status or err.statusCode if it is 4xx or 5xx, and if not, sets it to 500.
|
||||
// It won't add any more info to it if server is running in production, which is exactly what we want,
|
||||
// we want to share as little info as possible when error happens in production, for security reasons,
|
||||
// so they will get only status code if set, or 500 if not, no extra info.
|
||||
// In development it will also share the error stack though, which is useful.
|
||||
// If the user wants to put more information about the error into the response, they should use HttpError.
|
||||
return next(err)
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user