Repository navigation
refactor exceptions - #3333
Merged
Merged
refactor exceptions#3333
Conversation
davidism
force-pushed
the
exception-response
branch
from
October 17, 2026 03:35
7c45ec2 to
864cde8
Compare
Member
Author
|
Noticed that a few of the exception class names don't match the status phrase listed in RFC 9110, MDN, and
There's a few that are from WebDAV too. There's no reason we should have these, but I'll just leave them for now.
|
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.
Mainly, deprecate the various builder methods on
HTTPExceptionand theenvrionandscopearguments. Then, cleaned up all the descriptions and docs.HTTPException.get_description,get_body, andget_headersare deprecated. Passingdescriptionor overridingget_responsecovers anything that's needed, a lot more simply.environandscopearguments to those methods are deprecated. They weren't used anywhere, including in frameworks that could have passed them.namecan be set as a class attribute, or is pulled fromHTTPStatus.phraseif not set.codeanddescriptioncan't be none, simplifying type checking. They default to 0 and empty, but will be filled in by all concrete exceptions.__doc__is automatically prefixed with{code} {name},description, and a link to MDN, if it's not already prefixed. This allows adding additional:paramor..versionchangeditems, without repeating the definitions in the doc.get_responsecreates a response object and setscontent_type. Subclasses override it, callsuper, then add additional headers using the header properties, rather than constructing the low-level list of tuples.part of #3281