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,32 +271,38 @@ 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) {
switch(code) { SWIG_CSharpExceptionArgumentCodes exception_code = SWIG_CSharpArgumentOutOfRangeException;
case SWIG_MemoryError: SWIG_CSharpSetPendingExceptionArgument(exception_code, msg, 0);
exception_code = SWIG_CSharpOutOfMemoryException; } else {
break; SWIG_CSharpExceptionCodes exception_code = SWIG_CSharpApplicationException;
case SWIG_IndexError: switch(code) {
exception_code = SWIG_CSharpIndexOutOfRangeException; case SWIG_MemoryError:
break; exception_code = SWIG_CSharpOutOfMemoryException;
case SWIG_DivisionByZero: break;
exception_code = SWIG_CSharpDivideByZeroException; case SWIG_IndexError:
break; exception_code = SWIG_CSharpIndexOutOfRangeException;
case SWIG_ValueError: break;
exception_code = SWIG_CSharpArgumentOutOfRangeException; case SWIG_DivisionByZero:
break; exception_code = SWIG_CSharpDivideByZeroException;
case SWIG_IOError: break;
case SWIG_RuntimeError: case SWIG_IOError:
case SWIG_TypeError: exception_code = SWIG_CSharpIOException;
case SWIG_OverflowError: break;
case SWIG_SyntaxError: case SWIG_OverflowError:
case SWIG_SystemError: exception_code = SWIG_CSharpOverflowException;
case SWIG_UnknownError: break;
default: case SWIG_RuntimeError:
exception_code = SWIG_CSharpSystemException; case SWIG_TypeError:
break; case SWIG_SyntaxError:
case SWIG_SystemError:
case SWIG_UnknownError:
default:
exception_code = SWIG_CSharpApplicationException;
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; }
%} %}