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 e instead of raise ... only when catching error with try-except in python #10949

Closed
TommyDew42 opened this issue Nov 9, 2022 · 1 comment

Comments

@TommyDew42
Copy link
Contributor

What language does this apply to?
Python

Describe the problem you are trying to solve.
In some of the python code, we only raise an error without using the from after catching an error with except.
For example: json_format.py
This makes debugging sometimes difficult, especially the try block is a huge chunk of logic. We are not sure which line of code caused the error.

Describe the solution you'd like
Use raise ... from ... instead of raise ... only

Describe alternatives you've considered

Additional context
Happy to work on this if we think it's a good idea.

@TommyDew42 TommyDew42 added the untriaged auto added to all issues by default when created. label Nov 9, 2022
@acozzette acozzette added python help wanted and removed untriaged auto added to all issues by default when created. labels Nov 10, 2022
@acozzette
Copy link
Member

This sounds like a reasonable change and we would be happy to have someone review it if you would like to send a pull request.

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

Successfully merging a pull request may close this issue.

2 participants