File tree Expand file tree Collapse file tree
doc/data/messages/r/raise-missing-from Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ try :
2+ 1 / 0
3+ except ZeroDivisionError as e :
4+ raise ValueError ("Rectangle Area cannot be zero" ) # [raise-missing-from]
Original file line number Diff line number Diff line change 1+ You are raising the %s exception after the %s exception was caught.
2+ It's likely that the second exception is a friendly re-wrapping of the first exception,
3+ therefore you should use ``raise new_exception from old_exception `` to see an accurate message
4+ between the two tracebacks.
Original file line number Diff line number Diff line change 1+ try :
2+ 1 / 0
3+ except ZeroDivisionError as e :
4+ raise ValueError ("Rectangle Area cannot be zero" ) from e
Original file line number Diff line number Diff line change 1+ - `PEP 3132 <https://www.python.org/dev/peps/pep-3132/ >`_
Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ def _is_raising(body: list) -> bool:
131131 "try-except-raise block!" ,
132132 ),
133133 "W0707" : (
134- "Consider explicitly re-raising using the ' from' keyword " ,
134+ "Consider explicitly re-raising using 'raise NewError(...) from old_error' " ,
135135 "raise-missing-from" ,
136136 "Python 3's exception chaining means it shows the traceback of the "
137137 "current exception, but also the original exception. Not using `raise "
Original file line number Diff line number Diff line change 1- raise-missing-from:11:4:11:18::Consider explicitly re-raising using the ' from' keyword :UNDEFINED
2- raise-missing-from:19:4:19:25::Consider explicitly re-raising using the ' from' keyword :UNDEFINED
3- raise-missing-from:25:4:25:18::Consider explicitly re-raising using the ' from' keyword :UNDEFINED
4- raise-missing-from:31:4:31:18::Consider explicitly re-raising using the ' from' keyword :UNDEFINED
5- raise-missing-from:45:20:45:34::Consider explicitly re-raising using the ' from' keyword :UNDEFINED
6- raise-missing-from:53:4:53:20::Consider explicitly re-raising using the ' from' keyword :UNDEFINED
7- raise-missing-from:59:4:59:47::Consider explicitly re-raising using the ' from' keyword :UNDEFINED
1+ raise-missing-from:11:4:11:18::Consider explicitly re-raising using 'raise NewError(...) from old_error' :UNDEFINED
2+ raise-missing-from:19:4:19:25::Consider explicitly re-raising using 'raise NewError(...) from old_error' :UNDEFINED
3+ raise-missing-from:25:4:25:18::Consider explicitly re-raising using 'raise NewError(...) from old_error' :UNDEFINED
4+ raise-missing-from:31:4:31:18::Consider explicitly re-raising using 'raise NewError(...) from old_error' :UNDEFINED
5+ raise-missing-from:45:20:45:34::Consider explicitly re-raising using 'raise NewError(...) from old_error' :UNDEFINED
6+ raise-missing-from:53:4:53:20::Consider explicitly re-raising using 'raise NewError(...) from old_error' :UNDEFINED
7+ raise-missing-from:59:4:59:47::Consider explicitly re-raising using 'raise NewError(...) from old_error' :UNDEFINED
You can’t perform that action at this time.
0 commit comments