use internal SWIG_exception_fail, let SWIG_exception as in 1.3.27

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8434 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-01-14 21:23:36 +00:00
commit 507a8184cc
10 changed files with 40 additions and 21 deletions

View file

@ -1 +1,5 @@
%include <typemaps/exception.swg>
%insert("runtime") {
%define_as(SWIG_exception(code, msg), %block(%error(code, msg);))
}

View file

@ -1 +1,6 @@
%include <typemaps/exception.swg>
%insert("runtime") {
%define_as(SWIG_exception(code, msg), %block(%error(code, msg); SWIG_fail; ))
}

View file

@ -1 +1,5 @@
%include <typemaps/exception.swg>
%insert("runtime") {
%define_as(SWIG_exception(code, msg), %block(%error(code, msg);))
}

View file

@ -5,8 +5,9 @@
* ------------------------------------------------------------ */
/* ------------------------------------------------------------
* The Ruby global rename rules
* The Ruby auto rename rules
* ------------------------------------------------------------ */
#if defined(SWIG_RUBY_AUTORENAME)
/* Class names are CamelCase */
%rename("%(camelcase)s", %isclass) "";
@ -16,7 +17,8 @@
/* Method names should be changed so that they are
lower_case_with_underscores */
%rename("%(undercase)s", %isfunction, %ismember) "";
%rename("%(undercase)s", %isfunction, %ismember) "";
#endif
/* ------------------------------------------------------------
* Inner macros

View file

@ -1 +1,6 @@
%include <typemaps/exception.swg>
%insert("runtime") {
%define_as(SWIG_exception(code, msg), %block(%error(code, msg); return TCL_ERROR;))
}

View file

@ -67,7 +67,7 @@
*/
#ifndef %attribute_exception
#define %attribute_exception(code,msg) SWIG_exception(code,msg)
#define %attribute_exception(code,msg) SWIG_exception_fail(code,msg)
#endif
//

View file

@ -19,8 +19,7 @@
%insert("runtime") {
%define_as(SWIG_exception(code, msg),
%block(%error(code, msg); SWIG_fail))
%define_as(SWIG_exception_fail(code, msg), %block(%error(code, msg); SWIG_fail))
%define_as(SWIG_contract_assert(expr, msg),
if (!(expr)) { %error(SWIG_RuntimeError, msg); SWIG_fail; } else)
@ -41,7 +40,7 @@
}
SWIG_CATCH_STDEXCEPT // catch std::exception
catch (...) {
SWIG_exception(SWIG_UnknownError, "Unknown exception");
SWIG_exception_fail(SWIG_UnknownError, "Unknown exception");
}
}
*/
@ -51,27 +50,27 @@
%define SWIG_CATCH_STDEXCEPT
/* catching std::exception */
catch (std::invalid_argument& e) {
SWIG_exception(SWIG_ValueError, e.what() );
SWIG_exception_fail(SWIG_ValueError, e.what() );
} catch (std::domain_error& e) {
SWIG_exception(SWIG_ValueError, e.what() );
SWIG_exception_fail(SWIG_ValueError, e.what() );
} catch (std::overflow_error& e) {
SWIG_exception(SWIG_OverflowError, e.what() );
SWIG_exception_fail(SWIG_OverflowError, e.what() );
} catch (std::out_of_range& e) {
SWIG_exception(SWIG_IndexError, e.what() );
SWIG_exception_fail(SWIG_IndexError, e.what() );
} catch (std::length_error& e) {
SWIG_exception(SWIG_IndexError, e.what() );
SWIG_exception_fail(SWIG_IndexError, e.what() );
} catch (std::runtime_error& e) {
SWIG_exception(SWIG_RuntimeError, e.what() );
SWIG_exception_fail(SWIG_RuntimeError, e.what() );
} catch (std::exception& e) {
SWIG_exception(SWIG_SystemError, e.what() );
SWIG_exception_fail(SWIG_SystemError, e.what() );
}
%enddef
%define SWIG_CATCH_UNKNOWN
catch (std::exception& e) {
SWIG_exception(SWIG_SystemError, e.what() );
SWIG_exception_fail(SWIG_SystemError, e.what() );
}
catch (...) {
SWIG_exception(SWIG_UnknownError, "unknown exception");
SWIG_exception_fail(SWIG_UnknownError, "unknown exception");
}
%enddef

View file

@ -12,7 +12,7 @@
%exceptionclass Exception;
#if !defined(SWIG_STD_EXCEPTIONS_AS_CLASSES)
%typemap(throws,noblock=1) Exception {
SWIG_exception(Code, $1.what());
SWIG_exception_fail(Code, $1.what());
}
%ignore Exception;
struct Exception {

View file

@ -439,7 +439,7 @@
}
%typemap(throws,noblock=1) (...) {
SWIG_exception(SWIG_RuntimeError,"unknown exception");
SWIG_exception_fail(SWIG_RuntimeError,"unknown exception");
}
/* ------------------------------------------------------------

View file

@ -133,10 +133,10 @@
#define %error_block(Block...) %block(Block)
#define %default_code(code) ((code != SWIG_ERROR) ? code : SWIG_TypeError)
#define %argument_fail(code, type, name, argn) SWIG_exception(%default_code(code), %argfail_fmt(type, name, argn))
#define %argument_nullref(type, name, argn) SWIG_exception(SWIG_ValueError, %argnullref_fmt(type, name, argn))
#define %variable_fail(code, type, name) SWIG_exception(%default_code(code), %varfail_fmt(type, name))
#define %variable_nullref(type, name) SWIG_exception(SWIG_ValueError, %varnullref_fmt(type, name))
#define %argument_fail(code, type, name, argn) SWIG_exception_fail(%default_code(code), %argfail_fmt(type, name, argn))
#define %argument_nullref(type, name, argn) SWIG_exception_fail(SWIG_ValueError, %argnullref_fmt(type, name, argn))
#define %variable_fail(code, type, name) SWIG_exception_fail(%default_code(code), %varfail_fmt(type, name))
#define %variable_nullref(type, name) SWIG_exception_fail(SWIG_ValueError, %varnullref_fmt(type, name))
#if defined(SWIG_DIRECTOR_TYPEMAPS)
#define %dirout_fail(code, type) SWIG_DirOutFail(%default_code(code), %outfail_fmt(type))