[PyKDE] Handling exceptions in SIP

Denis S. Otkidach ods at strana.ru
Mon Jun 6 17:23:56 BST 2005

I hope it's correct place to ask general questions about SIP.

Am I correct that automatic exception handling in SIP is useless?  I see
several problems with it.  First, the code for method with signature
"void error() throw (exception);" is:

    sipCpp -> Test::error();
    catch (exception &e)
            /* Hope that there is a valid copy ctor. */ 
            exception *sipCpp = new exception(e);

            return NULL;

The copy of exception is generated and important information is lost (in
fact, std::exception used above is never raised itself, but holds what()
virtual method redefined in subclasses).

Second, the only way to map C++ exception to python object is wrapping
exception class, %MappedType doesn't work.  But then I see no way to
subclass standard Exception class.

Am I missing something?

Denis S. Otkidach 
http://www.python.ru/      [ru]

More information about the PyQt mailing list