Skip to content

Commit ca50f70

Browse files
matusvalosprytnyk
andcommitted
Added example for bad-except-order
Co-authored-by: Vladyslav Krylasov <[email protected]>
1 parent 333d851 commit ca50f70

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
try:
2+
print(int(input()))
3+
except Exception:
4+
raise
5+
except TypeError: # [bad-except-order]
6+
# This block cannot be reached since TypeError exception
7+
# is caught by previous exception handler.
8+
raise
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
try:
2+
print(int(input()))
3+
except TypeError:
4+
raise
5+
except Exception:
6+
raise

0 commit comments

Comments
 (0)