swig/Examples/python/exception/runme.py
Marcelo Matus 54737ee9a9 - recover the proper catching exception mechanism for classes
(throw typemap).

- fix the examples with exception problems and warnings

- proper and consist treatment of basic types (short, unsigned char,...)

  now all are checked for range and sign. Before, this was depending of
  the use of parsing or no parsing, and/or the converter method, and/or
  the use of directors, etc.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5659 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-21 01:15:10 +00:00

36 lines
551 B
Python

# 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