/tags/rel-1.3.35/Examples/python/exception/runme.py
Python | 36 lines | 25 code | 9 blank | 2 comment | 12 complexity | f3bf227277495a3307735aaee22a71fe MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
1# file: runme.py
2
3# Throw a lot of exceptions
4
5import example
6
7t = example.Test()
8try:
9 t.unknown()
10except RuntimeError,e:
11 print "incomplete type", e.args[0]
12
13try:
14 t.simple()
15except RuntimeError,e:
16 print e.args[0]
17
18try:
19 t.message()
20except RuntimeError,e:
21 print e.args[0]
22
23try:
24 t.hosed()
25except example.Exc,e:
26 print e.code, e.msg
27
28for i in range(1,4):
29 try:
30 t.multi(i)
31 except RuntimeError,e:
32 print e.args[0]
33 except example.Exc,e:
34 print e.code, e.msg
35
36