6 // This SWIG library file provides language independent exception handling
9 %section "Exception Handling Library",info,after,pre,nosort,skip=1,chop_left=3,chop_right=0,chop_top=0,chop_bottom=0
14 This library provides language independent support for raising scripting
15 language exceptions in SWIG generated wrapper code. Normally, this is
16 used in conjunction with the %except directive.
18 To raise an exception, use the following function call :
20 SWIG_exception(int exctype, char *msg);
22 'exctype' is an exception type code and may be one of the following :
36 'msg' is an error string that should be reported to the user.
38 The library is normally used in conjunction with the %except directive
45 SWIG_exception(SWIG_IndexError,"Array index out of bounds");
47 SWIG_exception(SWIG_UnknownError,"Uncaught exception");
51 It is important to note that the SWIG_exception() function is only available
52 to the C code generated by SWIG. It is not available in the scripting language
59 #define SWIG_MemoryError 1
60 #define SWIG_IOError 2
61 #define SWIG_RuntimeError 3
62 #define SWIG_IndexError 4
63 #define SWIG_TypeError 5
64 #define SWIG_DivisionByZero 6
65 #define SWIG_OverflowError 7
66 #define SWIG_SyntaxError 8
67 #define SWIG_ValueError 9
68 #define SWIG_SystemError 10
69 #define SWIG_UnknownError 99
74 #define SWIG_exception(a,b) Tcl_SetStringObj(tcl_result,b,-1); return TCL_ERROR
79 #define SWIG_exception(a,b) Tcl_SetResult(interp,b,TCL_VOLATILE); return TCL_ERROR
86 #define SWIG_exception(a,b) croak(b)
92 #define SWIG_exception(a,b) fatal(b)
98 static void _SWIG_exception(int code, char *msg) {
100 case SWIG_MemoryError:
101 PyErr_SetString(PyExc_MemoryError,msg);
104 PyErr_SetString(PyExc_IOError,msg);
106 case SWIG_RuntimeError:
107 PyErr_SetString(PyExc_RuntimeError,msg);
109 case SWIG_IndexError:
110 PyErr_SetString(PyExc_IndexError,msg);
113 PyErr_SetString(PyExc_TypeError,msg);
115 case SWIG_DivisionByZero:
116 PyErr_SetString(PyExc_ZeroDivisionError,msg);
118 case SWIG_OverflowError:
119 PyErr_SetString(PyExc_OverflowError,msg);
121 case SWIG_SyntaxError:
122 PyErr_SetString(PyExc_SyntaxError,msg);
124 case SWIG_ValueError:
125 PyErr_SetString(PyExc_ValueError,msg);
127 case SWIG_SystemError:
128 PyErr_SetString(PyExc_SystemError,msg);
131 PyErr_SetString(PyExc_RuntimeError,msg);
136 #define SWIG_exception(a,b) _SWIG_exception(a,b); return NULL
142 exception.i : Guile not currently supported.