C# exceptions - wider range of exceptions to throw

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6986 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2005-02-22 22:57:39 +00:00
commit 4e685824fd

View file

@ -271,7 +271,11 @@ static void SWIG_exception_(int code, const char *msg) {
#ifdef SWIGCSHARP #ifdef SWIGCSHARP
%{ %{
static void SWIG_CSharpException(int code, const char *msg) { static void SWIG_CSharpException(int code, const char *msg) {
SWIG_CSharpExceptionCodes exception_code = SWIG_CSharpSystemException; if (code == SWIG_ValueError) {
SWIG_CSharpExceptionArgumentCodes exception_code = SWIG_CSharpArgumentOutOfRangeException;
SWIG_CSharpSetPendingExceptionArgument(exception_code, msg, 0);
} else {
SWIG_CSharpExceptionCodes exception_code = SWIG_CSharpApplicationException;
switch(code) { switch(code) {
case SWIG_MemoryError: case SWIG_MemoryError:
exception_code = SWIG_CSharpOutOfMemoryException; exception_code = SWIG_CSharpOutOfMemoryException;
@ -282,22 +286,24 @@ static void SWIG_CSharpException(int code, const char *msg) {
case SWIG_DivisionByZero: case SWIG_DivisionByZero:
exception_code = SWIG_CSharpDivideByZeroException; exception_code = SWIG_CSharpDivideByZeroException;
break; break;
case SWIG_ValueError:
exception_code = SWIG_CSharpArgumentOutOfRangeException;
break;
case SWIG_IOError: case SWIG_IOError:
exception_code = SWIG_CSharpIOException;
break;
case SWIG_OverflowError:
exception_code = SWIG_CSharpOverflowException;
break;
case SWIG_RuntimeError: case SWIG_RuntimeError:
case SWIG_TypeError: case SWIG_TypeError:
case SWIG_OverflowError:
case SWIG_SyntaxError: case SWIG_SyntaxError:
case SWIG_SystemError: case SWIG_SystemError:
case SWIG_UnknownError: case SWIG_UnknownError:
default: default:
exception_code = SWIG_CSharpSystemException; exception_code = SWIG_CSharpApplicationException;
break; break;
} }
SWIG_CSharpSetPendingException(exception_code, msg); SWIG_CSharpSetPendingException(exception_code, msg);
} }
}
#define SWIG_exception(nullreturn, code, msg) { SWIG_CSharpException(code, msg); return nullreturn; } #define SWIG_exception(nullreturn, code, msg) { SWIG_CSharpException(code, msg); return nullreturn; }
%} %}
#endif // SWIGCSHARP #endif // SWIGCSHARP