/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
- # file: runme.py
- # Throw a lot of exceptions
- import example
- t = example.Test()
- try:
- t.unknown()
- except RuntimeError,e:
- print "incomplete type", e.args[0]
- try:
- t.simple()
- except RuntimeError,e:
- print e.args[0]
- try:
- t.message()
- except RuntimeError,e:
- print e.args[0]
- try:
- t.hosed()
- except example.Exc,e:
- print e.code, e.msg
- for i in range(1,4):
- try:
- t.multi(i)
- except RuntimeError,e:
- print e.args[0]
- except example.Exc,e:
- print e.code, e.msg