[PyKDE] Handling exceptions in SIP
Phil Thompson
phil at riverbankcomputing.co.uk
Mon Jun 6 17:54:43 BST 2005
On Monday 06 June 2005 5:23 pm, Denis S. Otkidach wrote:
> 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:
>
> try
> {
> sipCpp -> Test::error();
> }
> catch (exception &e)
> {
> /* Hope that there is a valid copy ctor. */
> exception *sipCpp = new exception(e);
>
> sipRaiseClassException(sipClass_exception,sipCpp);
> 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?
SIP's exception support was added by a user - I've never used it myself.
Suggestions for improvements always welcome.
Phil
More information about the PyQt
mailing list