Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a custom http error handler which take http-errors into account when constructing the http error page to send. This way its possible to control which http error to serve from where ever deeper down in the server code.
Podium do take http errors into account in the communication between layouts and podlets. A podlet can use http errors to signal to a layout what action to take if something fails in a podlet so we should make it easy to do this from the code the developer will write.
With this a user can then ex do stuff like this in a custom server.js file:
And the app will serve an error page (with correct http error status code) like so if the
fetch()
method to an upstream service errors:Since this is based on passing on http-errors objects we might want to expose the internal http-errors module one way or another so the users don't have to import this them self (as the above example does). Maybe we should expose it along with the config, logger etc as such: