-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Don't suppress exception chaining for optional dependencies #43882
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
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 @takluyver, looks like a nice improvement! Can you please add a quick note in the whatsnew
for 1.4 mentioning this improved error message? Also might be nice to have a test for this (if not too cumbersome)
Thanks, 🤞 that test works. I'm editing from the web interface. 🙂 |
Co-authored-by: Thomas Li <[email protected]>
close/reopen for CI |
thanks @takluyver very nice! |
Thanks all 🙂 |
I've just been helping someone for whom the helpful error message appears to have obscured the real cause of the problem. Specifically, Jinja2 is present, but one of its dependencies is not. So the error message saying "Missing optional dependency: 'Jinja2'..." is rather confusing.
Automatic exception chaining is really great for things like this - you can provide a more descriptive error message while still having the original exception details available for inspection. I'd argue that it should only be disabled (
raise ... from None
) if you're absolutely sure that there will be no useful information in the original exception.