File tree 6 files changed +21
-8
lines changed
doc/data/messages/r/raise-missing-from
6 files changed +21
-8
lines changed 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:
131
131
"try-except-raise block!" ,
132
132
),
133
133
"W0707" : (
134
- "Consider explicitly re-raising using the ' from' keyword " ,
134
+ "Consider explicitly re-raising using 'raise NewError(...) from old_error' " ,
135
135
"raise-missing-from" ,
136
136
"Python 3's exception chaining means it shows the traceback of the "
137
137
"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