[php] Improve %feature("director:except") docs
See https://github.com/swig/swig/pull/628
This commit is contained in:
parent
f474577d5b
commit
07b7edcd87
1 changed files with 14 additions and 6 deletions
|
|
@ -1147,12 +1147,20 @@ deleting all the Foo pointers it contains at some point.
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
With directors routing method calls to PHP, and proxies routing them
|
With directors routing method calls to PHP, and proxies routing them
|
||||||
to C++, the handling of exceptions is an important concern. By default, the
|
to C++, the handling of exceptions is an important concern. By default, an
|
||||||
directors ignore exceptions that occur during method calls that are
|
exception thrown in PHP code called from C++ causes the PHP interpreter
|
||||||
resolved in PHP. To handle such exceptions correctly, it is necessary
|
to flag that an exception is thrown, then return passes to C++ as if
|
||||||
to temporarily translate them into C++ exceptions. This can be done with
|
the PHP function had returned <code>Null</code>. Assuming the directorout
|
||||||
the %feature("director:except") directive. The following code should
|
typemaps handle this (those SWIG defines by default should) then once
|
||||||
suffice in most cases:
|
control returns to PHP code again, the PHP exception will actually propagate.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Sometimes this control flow is problematic, and you want to skip any
|
||||||
|
handling in the C++ code. To achieve this, it is necessary
|
||||||
|
to temporarily translate the PHP exception into a C++ exception. This can be
|
||||||
|
achieved using the %feature("director:except") directive. The following code
|
||||||
|
should suffice in most cases:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="code">
|
<div class="code">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue