Skip to content

Don't use 'raise exc from None' because it suppresses exception causes - #1158

Merged
lovelydinosaur merged 1 commit into
Kludex:masterfrom
oTree-org:master
Mar 29, 2021
Merged

lovelydinosaur merged 1 commit into
Kludex:masterfrom
oTree-org:master

Conversation

@oTree-org

Copy link
Copy Markdown
Contributor

Fixes #1114

I think raise exc from None is better for targeted cases (like catching KeyError to re-raise a more suitable exception). For catch-all clauses like except Exception we are potentially throwing out useful info about the cause.

@lovelydinosaur lovelydinosaur left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All of these cases look more correct to me without the "from None" yup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"raise exc from None" interferes with exception chaining

2 participants