fix: pass unhandled error on to next express error handler #1572
+20
−0
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.
Commit 0ae6f54 introduced an error handling middleware with this change. However, it does not delegate to the next error handler if it cannot handle the error adequately. This causes the request to hang until a timeout kills the connection. By passing the error on to next, other error handlers (like the default error handler) handle it.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
A request "hangs" may hang if an error is thrown in some express middleware.
In case
ExpressLoader
does not handle the error in its error handler function,nothing happens with the request anymore and it hangs until the connection is terminated (e.g. due to timeout).
Issue Number: N/A (I didn't create a separate issue, let me know I you need that)
What is the new behavior?
the error handler defined in
ExpressLoader
callsnext(err)
in case it cannot adequately handle the error.This way, other error handlers can take care of it.
Does this PR introduce a breaking change?
Other information