-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix exception causes in client.py #4815
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4815 +/- ##
=======================================
Coverage 97.60% 97.60%
=======================================
Files 43 43
Lines 8932 8932
Branches 1406 1406
=======================================
Hits 8718 8718
Misses 95 95
Partials 119 119 Continue to review full report at Codecov.
|
If I understand correctly, the test failure here is not related to my change. (I see it's happening on other PRs.) |
Codecov Report
@@ Coverage Diff @@
## master #4815 +/- ##
==========================================
- Coverage 97.66% 97.65% -0.02%
==========================================
Files 43 43
Lines 8983 8983
Branches 1412 1412
==========================================
- Hits 8773 8772 -1
- Misses 97 98 +1
Partials 113 113
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Agree, you are right. |
Co-authored-by: Andrew Svetlov <[email protected]>
💚 Backport successfulThe PR was backported to the following branches:
|
Backports the following commits to 3.7: - Fix exception causes in client.py (#4815) Co-authored-by: Ram Rachum <[email protected]>
I recently went over Matplotlib, Pandas and NumPy, fixing a small mistake in the way that Python 3's exception chaining is used. If you're interested, I can do it here too. I've done it on just one file right now.
The mistake is this: In some parts of the code, an exception is being caught and replaced with a more user-friendly error. In these cases the syntax
raise new_error from old_error
needs to be used.Python 3's exception chaining means it shows not only the traceback of the current exception, but that of the original exception (and possibly more.) This is regardless of
raise from
. The usage ofraise from
tells Python to put a more accurate message between the tracebacks. Instead of this:You'll get this:
The first is inaccurate, because it signifies a bug in the exception-handling code itself, which is a separate situation than wrapping an exception.
Let me know what you think!