-
Notifications
You must be signed in to change notification settings - Fork 105
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
Raise exception with cause exception #915
base: master
Are you sure you want to change the base?
Conversation
7b2e3c1
to
a8ef8d7
Compare
Pull requests framed like this create more work for the maintainer than necessary. |
hi @tomchristie, here is the updated use case : try:
resp = pool.request('GET', 'https://example.com')
except ConnectError as error:
# before
assert error.__cause__ is None
# after
assert isinstance(error.__cause__, ssl.SSLError) |
Can you demo the traceback in both cases? I'm reluctant to bring this in too easily... |
This change was introduced in the #880. I can't see this change fixing any bugs or causing any bugs though. From my point of view, it just influence the information used for debug and trace, and this change rather breaks the coherence of traceback. Note the extra "line 216".
Here is the traceback before and after my PR:
after:
|
This would be great to fix! We have also hit this issue so many times where we dont see anything about the actual cause for different network issues. (We are using Sentry to monitor the errors and we dont see much of details about the problems as httpcore hides these annoyingly.) We could also enable this linting rule https://docs.astral.sh/ruff/rules/raise-without-from-inside-except/ under |
Summary
In the current logic, the original exception is discarded, which makes it hard to determine the thrown exception more precisely.
Checklist
Use case