-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Make HTTPException truthy #3098
Conversation
raise Exception('CustomException') | ||
except Exception as exc: | ||
raise web.HTTPException() from exc | ||
tb = ''.join(format_exception(ei.type, ei.value, ei.tb)) |
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.
is ei
available outside of with
block?
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.
Yes it is.
We use it widely in the test suite:
with pytest.raises(aiohttp.ClientResponseError) as info:
await response.start(connection)
assert info.value.request_info is request_info
Codecov Report
@@ Coverage Diff @@
## master #3098 +/- ##
==========================================
+ Coverage 98.05% 98.05% +<.01%
==========================================
Files 43 43
Lines 7828 7830 +2
Branches 1353 1353
==========================================
+ Hits 7676 7678 +2
Misses 56 56
Partials 96 96
Continue to review full report at Codecov.
|
raise Exception('CustomException') | ||
except Exception as exc: | ||
raise web.HTTPException() from exc | ||
tb = ''.join(format_exception(ei.type, ei.value, ei.tb)) |
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.
Yes it is.
We use it widely in the test suite:
with pytest.raises(aiohttp.ClientResponseError) as info:
await response.start(connection)
assert info.value.request_info is request_info
@jcjf Thank you |
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?
Fixes #3096
Are there changes in behavior for the user?
More informative tracebacks when using
raise from
syntax.Related issue number
#3096
Checklist
CONTRIBUTORS.txt
CHANGES
folder<issue_id>.<type>
for example (588.bugfix)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.