Thanks for all the help! Here is a 3rd and last question.<br>Once I have figured this one out, I will be done porting my project from boost.python to SIP.<br><br>I need to translate C++ exceptions to Python exceptions.<br>
I have a function that does that:<br><br>    void translate(const std::exception& e)<br>    {<br>        if(dynamic_cast<const FailedToOpenFile*>(&e))<br>            PyErr_SetString(PyExc_IOError, e.what());<br>
        else if(dynamic_cast<const EndOfFile*>(&e))<br>            PyErr_SetString(PyExc_EOFError, e.what());<br>        ...<br>    }<br><br>Next I need to "apply" this function to all wrapped functions.<br>
With boost.python I do that as follows:<br><br>    boost::python::register_exception_translator<std::exception>(&translate);<br><br>With SWIG I do:<br><br>    %exception {<br>        try {<br>            $action<br>
        } catch(const std::exception& e) {<br>            translate(e);<br>            return NULL;<br>        }<br>    }<br><br>How do I do that with SIP?<br><br><br><br><br>