Skip to content

Conversation

@F30
Copy link

@F30 F30 commented Mar 16, 2015

This is barely noticeable in the development code since #839, but in the latest released version. The current code to normalize the error condition misses its apparent purpose: code_or_exception will never be an instance of HTTPException, as one might only supply an exception class and not an object.
The bug still appears when you declare an errorhandler for a numeric code after setting one for the respective exception: Then, the exception's handler will always take precedence.

The HTTPException base class has no code and therefore must be dealt with like any other exception.

F30 added 2 commits March 16, 2015 12:00
When declaring an errorhandler for a numeric code after setting one for the
associated exception, the second one doesn't take precedence.
This is barely noticeable since @3d67736, but the previous code to normalize
the error condition missed its apparent purpose: code_or_exception will never
be an instance of HTTPException, as one might only supply an exception class
and not an object.
The bug still appeared when you declare an errorhandler for a numeric code
after setting one for the respective exception: Then, the exception's handler
always took precedence.

The HTTPException base class has no code and therefore must be dealt with like
any other exception.
@davidism
Copy link
Member

The test case passes without changes in master.

@davidism davidism closed this Apr 17, 2017
cerickson added a commit to cerickson/flask that referenced this pull request May 22, 2017
Error handlers are now returned in order of blueprint:code, app:code,
blueprint:HTTPException, app:HTTPException, None

Corresponding tests also added.

Ref issue pallets#941, pr pallets#1383, pallets#2082, pallets#2144
cerickson added a commit to cerickson/flask that referenced this pull request May 23, 2017
Error handlers are now returned in order of blueprint:code, app:code,
blueprint:HTTPException, app:HTTPException, None

Corresponding tests also added.

Ref issue pallets#941, pr pallets#1383, pallets#2082, pallets#2144
cerickson added a commit to cerickson/flask that referenced this pull request May 23, 2017
Error handlers are now returned in order of blueprint:code, app:code,
blueprint:HTTPException, app:HTTPException, None

Corresponding tests also added.

Ref issue pallets#941, pr pallets#1383, pallets#2082, pallets#2144
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants