blob: ea95721689f0db6251266378176a35ab77fe4c9f [file]
/* -----------------------------------------------------------------------------
* exception.swg
*
* Defines SWIG_exception(code, msg) and the SWIG_exception fragment with any support code that it needs.
* SWIG_exception raises the target language error for a SWIG error code and leaves the wrapper function.
* Included by swigcommon.swg.
* ----------------------------------------------------------------------------- */
/* Map a SWIG error code to a Java exception */
%fragment("SWIG_JavaException", "header") %{
SWIGINTERN void SWIG_JavaException(JNIEnv *jenv, int code, const char *msg) {
SWIG_JavaExceptionCodes exception_code = SWIG_JavaUnknownError;
switch(code) {
case SWIG_MemoryError:
exception_code = SWIG_JavaOutOfMemoryError;
break;
case SWIG_IOError:
exception_code = SWIG_JavaIOException;
break;
case SWIG_SystemError:
case SWIG_RuntimeError:
exception_code = SWIG_JavaRuntimeException;
break;
case SWIG_OverflowError:
case SWIG_IndexError:
exception_code = SWIG_JavaIndexOutOfBoundsException;
break;
case SWIG_DivisionByZero:
exception_code = SWIG_JavaArithmeticException;
break;
case SWIG_SyntaxError:
case SWIG_ValueError:
case SWIG_TypeError:
exception_code = SWIG_JavaIllegalArgumentException;
break;
case SWIG_NullReferenceError:
exception_code = SWIG_JavaNullPointerException;
break;
case SWIG_UnknownError:
default:
exception_code = SWIG_JavaUnknownError;
break;
}
SWIG_JavaThrowException(jenv, exception_code, msg);
}
%}
/* Raise the error for a SWIG error code and leave the wrapper */
#define SWIG_exception(code, msg) { SWIG_JavaException(jenv, code, msg); return $null; }
%fragment("SWIG_exception", "header", fragment="SWIG_JavaException") {}