Updated Ruby Exception handling. Classes that are specified in throws clauses, or are marked as %exceptionclass, are now inherited from rb_eRuntimeError. This allows instances of these classes to be returned to Ruby as exceptions. Thus if a C++ method throws an instance of MyException, the calling Ruby method will get back a MyException object. To see an example, look at ruby/examples/exception_class.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8353 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
17dbf525da
commit
c2399a7aa2
3 changed files with 36 additions and 2 deletions
|
|
@ -1800,7 +1800,13 @@ public:
|
|||
Printv(s, tab4, "rb_undef_alloc_func(", klass->vname, ");\n", NIL);
|
||||
Replaceall(klass->init,"$allocator", s);
|
||||
Replaceall(klass->init,"$initializer", "");
|
||||
Replaceall(klass->init,"$super", "rb_cObject");
|
||||
|
||||
if (GetFlag(n,"feature:exceptionclass")) {
|
||||
Replaceall(klass->init,"$super", "rb_eRuntimeError");
|
||||
}
|
||||
else {
|
||||
Replaceall(klass->init,"$super", "rb_cObject");
|
||||
}
|
||||
Delete(s);
|
||||
|
||||
Printv(f_init,klass->init,NIL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue