Use raise ... from e
instead of raise ...
only when catching error with try-except in python
#10949
Labels
raise ... from e
instead of raise ...
only when catching error with try-except in python
#10949
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 thefrom
after catching an error withexcept
.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 ofraise ...
onlyDescribe alternatives you've considered
Additional context
Happy to work on this if we think it's a good idea.
The text was updated successfully, but these errors were encountered: