Index: swig/Lib/python/pyerrors.swg |
=================================================================== |
--- swig/Lib/python/pyerrors.swg (revision 0) |
+++ swig/Lib/python/pyerrors.swg (revision 0) |
@@ -0,0 +1,70 @@ |
+/* ----------------------------------------------------------------------------- |
+ * error manipulation |
+ * ----------------------------------------------------------------------------- */ |
+ |
+SWIGRUNTIME PyObject* |
+SWIG_Python_ErrorType(int code) { |
+ PyObject* type = 0; |
+ switch(code) { |
+ case SWIG_MemoryError: |
+ type = PyExc_MemoryError; |
+ break; |
+ case SWIG_IOError: |
+ type = PyExc_IOError; |
+ break; |
+ case SWIG_RuntimeError: |
+ type = PyExc_RuntimeError; |
+ break; |
+ case SWIG_IndexError: |
+ type = PyExc_IndexError; |
+ break; |
+ case SWIG_TypeError: |
+ type = PyExc_TypeError; |
+ break; |
+ case SWIG_DivisionByZero: |
+ type = PyExc_ZeroDivisionError; |
+ break; |
+ case SWIG_OverflowError: |
+ type = PyExc_OverflowError; |
+ break; |
+ case SWIG_SyntaxError: |
+ type = PyExc_SyntaxError; |
+ break; |
+ case SWIG_ValueError: |
+ type = PyExc_ValueError; |
+ break; |
+ case SWIG_SystemError: |
+ type = PyExc_SystemError; |
+ break; |
+ case SWIG_AttributeError: |
+ type = PyExc_AttributeError; |
+ break; |
+ default: |
+ type = PyExc_RuntimeError; |
+ } |
+ return type; |
+} |
+ |
+ |
+SWIGRUNTIME void |
+SWIG_Python_AddErrorMsg(const char* mesg) |
+{ |
+ PyObject *type = 0; |
+ PyObject *value = 0; |
+ PyObject *traceback = 0; |
+ |
+ if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); |
+ if (value) { |
+ char *tmp; |
+ PyObject *old_str = PyObject_Str(value); |
+ PyErr_Clear(); |
+ Py_XINCREF(type); |
+ |
+ PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); |
+ SWIG_Python_str_DelForPy3(tmp); |
+ Py_DECREF(old_str); |
+ Py_DECREF(value); |
+ } else { |
+ PyErr_SetString(PyExc_RuntimeError, mesg); |
+ } |
+} |