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
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue