Repository navigation
Conversation
|
I'm in need of the same feature (and currently using a crude workaround), I'd love to see this fixed/merged. |
Originally i intended to rewrite the error handling system to register an error handler for each subclass of HTTPException on initialization of the Flask object, removing the distinction between HTTP exceptions and other exception types. However, with the current behavior of preferring the first-registered handler when an error occurs, doing this without compromises would require changing this to preferring the last-registered handler, a backwards-incompatible change. The following is a very minimal fix to only make Flask prioritize the user's error handlers over others. I am not sure which performance implications this has. Maybe a major rewrite of the error handling system is still desirable (with more complex prioritization of errorhandlers -- something based on "distance" in inheritance tree?), but at the moment i don't see a reason to do so, given that the current system is primitive enough to be understandable, while still usable.
Contributor
Author
|
Bump. |
Contributor
Author
|
It seems like i duplicated #839 without realizing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Originally i intended to rewrite the error handling system to register an
error handler for each subclass of HTTPException on initialization of the
Flask object, removing the distinction between HTTP exceptions and other
exception types. However, with the current behavior of preferring the
first-registered handler when an error occurs, doing this without compromises
would require changing this to preferring the last-registered handler, a
backwards-incompatible change.
The following is a very minimal fix to only make Flask prioritize the user's
error handlers over others. I am not sure which performance implications this
has. Maybe a major rewrite of the error handling system is still desirable
(with more complex prioritization of errorhandlers -- something based on
"distance" in inheritance tree?), but at the moment i don't see a reason to do
so, given that the current system is primitive enough to be understandable,
while still usable.