Correct %exception documentation so no memory is leaked - bug #2903761
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11759 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
1dd50f5ea8
commit
d756b28611
1 changed files with 16 additions and 1 deletions
|
|
@ -53,6 +53,21 @@ The <tt>%exception</tt> directive allows you to define a general purpose excepti
|
|||
handler. For example, you can specify the following:
|
||||
</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
%exception {
|
||||
try {
|
||||
$action
|
||||
}
|
||||
catch (RangeError) {
|
||||
... handle error ...
|
||||
}
|
||||
}
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
How the exception is handled depends on the target language, for example, Python:
|
||||
</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
%exception {
|
||||
try {
|
||||
|
|
@ -60,7 +75,7 @@ handler. For example, you can specify the following:
|
|||
}
|
||||
catch (RangeError) {
|
||||
PyErr_SetString(PyExc_IndexError,"index out-of-bounds");
|
||||
return NULL;
|
||||
SWIG_fail;
|
||||
}
|
||||
}
|
||||
</pre></div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue