Skip to content
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

Use raise .. from .. where appropriate #764

Merged
merged 2 commits into from
Sep 30, 2020

Conversation

akihironitta
Copy link
Contributor

@akihironitta akihironitta commented Sep 30, 2020

Motivation

Fixes and closes #761.

Description of the changes

I changed lines where raiseing an exception in except to either:

  1. raise .. from e to explicitly chain exceptions where the exception e has valuable information and seems useful for users.
  2. raise .. from None to unchain exceptions where the previous exception has no valuable information and seems noisy and redundant.

@akihironitta
Copy link
Contributor Author

akihironitta commented Sep 30, 2020

List of lines

I created a simple script to list all the lines containing raise in except clause.

@akihironitta
Copy link
Contributor Author

I actually didn't use raise .. from None because all the exceptions seem to have valuable information and it looks inappropriate to get rid of the information by using raise .. from None.

Copy link
Member

@fehiepsi fehiepsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this is very helpful. Thanks, @akihironitta!

@fehiepsi fehiepsi merged commit 68b87af into pyro-ppl:master Sep 30, 2020
@akihironitta akihironitta deleted the fix-exception-chaining branch October 15, 2020 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix exception chaining all over the codebase
2 participants