-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add deprecation warning when HTTPException is returned instead of raised #2515
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot.
What's about the next step?
I suggest adding a new build_response()
method to HTTPException
for construction a web.Response
object from exception instance.
I've tried to replace everything in aiohttp by build_response()
usage but figured out that the change is too invasive.
Dropped my attempt to get rid on inheritance from Response
in the single step.
But we still could release aiohttp 3.0 with build_response()
method and very encourage it.
Sorry, travis checks is broken by me. |
[INVALID QUESTION] I will add the build_response() method along with test in a while. Do we need reference to HTTPException instance in Response? (should I instantiate the object as done in HTTPException's constructor or by |
I'm not really a fan of the implementation in my last commit (as it includes some code repetition) but there were a few issues with my initial approach:
If there are any suggestions for a better approach I'd be more than happy to implement them :) |
I also thought about returning |
Making a new Let's go further. But you can get the main idea : Every class like In the future (aiohttp 4.0) we need to support the only our own parameters like Sorry for long message but sure, I've got my point. |
Wouldn't this change deprecate the From #2415 I got the sense that deprecation should come in waves. i.e.:
I have no stance/opinion/position on whether the deprecation should come in waves, just the sense that I got from the issue mentioned above. In any case, I'll look into modeling the changes needed here based on the example you provided. Sorry for the back-and-forth this pr required and thank you for the guideline :) |
I suggest merging this PR with deprecation warning only (with proper documentation update) and making a new PR for |
Codecov Report
@@ Coverage Diff @@
## master #2515 +/- ##
==========================================
+ Coverage 97.13% 97.13% +<.01%
==========================================
Files 39 39
Lines 8065 8068 +3
Branches 1414 1415 +1
==========================================
+ Hits 7834 7837 +3
Misses 99 99
Partials 132 132
Continue to review full report at Codecov.
|
thanks! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
What do these changes do?
Add DeprecationWarning when an HTTPException is returned instead of being raised.
Are there changes in behavior for the user?
If user's handler (view function) returns an HTTPException, a DeprecationWarning will be displayed.
Related issue number
Discussion in #2415
Checklist
CONTRIBUTORS.txt
CHANGES
folder<issue_id>.<type>
for example (588.bug)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.