Skip to content

Commit e276753

Browse files
committed
tests: Add testcases for catching user Exception subclasses.
1 parent 91e556a commit e276753

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/basics/subclass-native3.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,18 @@ class MyExc(Exception):
55
print(e)
66
print(repr(e))
77
print(e.args)
8+
9+
try:
10+
raise MyExc("Some error")
11+
except MyExc as e:
12+
print("Caught exception:", repr(e))
13+
14+
try:
15+
raise MyExc("Some error2")
16+
except Exception as e:
17+
print("Caught exception:", repr(e))
18+
19+
try:
20+
raise MyExc("Some error2")
21+
except:
22+
print("Caught user exception")

0 commit comments

Comments
 (0)