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:
parent
290a7da24c
commit
507a8184cc
10 changed files with 40 additions and 21 deletions
|
|
@ -1 +1,5 @@
|
|||
%include <typemaps/exception.swg>
|
||||
|
||||
%insert("runtime") {
|
||||
%define_as(SWIG_exception(code, msg), %block(%error(code, msg);))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1,6 @@
|
|||
%include <typemaps/exception.swg>
|
||||
|
||||
|
||||
%insert("runtime") {
|
||||
%define_as(SWIG_exception(code, msg), %block(%error(code, msg); SWIG_fail; ))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1,5 @@
|
|||
%include <typemaps/exception.swg>
|
||||
|
||||
%insert("runtime") {
|
||||
%define_as(SWIG_exception(code, msg), %block(%error(code, msg);))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1 +1,6 @@
|
|||
%include <typemaps/exception.swg>
|
||||
|
||||
|
||||
%insert("runtime") {
|
||||
%define_as(SWIG_exception(code, msg), %block(%error(code, msg); return TCL_ERROR;))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -439,7 +439,7 @@
|
|||
}
|
||||
|
||||
%typemap(throws,noblock=1) (...) {
|
||||
SWIG_exception(SWIG_RuntimeError,"unknown exception");
|
||||
SWIG_exception_fail(SWIG_RuntimeError,"unknown exception");
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue