add the %throws directive
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8348 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b604622255
commit
06a949da6d
5 changed files with 112 additions and 0 deletions
|
|
@ -15,6 +15,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
%throws(E1,E2) A::barfoo(int i);
|
||||
|
||||
|
||||
%inline %{
|
||||
struct E1
|
||||
|
|
@ -50,5 +52,16 @@
|
|||
throw E3();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int barfoo(int i)
|
||||
{
|
||||
if (i == 1) {
|
||||
throw E1();
|
||||
} else {
|
||||
throw E2();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -24,3 +24,18 @@ except RuntimeError,e:
|
|||
print "bad exception order",
|
||||
raise RuntimeError, e.args
|
||||
|
||||
|
||||
|
||||
try:
|
||||
a.barfoo(1)
|
||||
except E1,e:
|
||||
pass
|
||||
except:
|
||||
raise RuntimeError, "bad exception order"
|
||||
|
||||
try:
|
||||
a.barfoo(2)
|
||||
except E2,e:
|
||||
pass
|
||||
except:
|
||||
raise RuntimeError, "bad exception order"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue