[PySide] Shiboken C++ => Python exceptions translation

Hugo Parente Lima hugo.lima at openbossa.org
Mon Apr 30 16:47:10 CEST 2012


On Saturday, April 28, 2012 06:06:35 PM Dennis Victorovich wrote:
> Hi everyone.
> 
> Please correct me if i'm wrong, but currently shiboken doesn't have a
> mechanism for handling C++ code that throws exceptions.

You are right, PySide doesn't support exception translation.
 
> We've tackle this problem within our project and workaround is not really
> pretty (a bunch of extra code with try/catch and boost::bind).
> 
> Anyone have a bright ides how to solve the problem?
> I've created suggestion for improvement
> https://bugreports.qt-project.org/browse/PYSIDE-62.

You need to implement this feature on the Generator itself, I would separate 
this in two steps:

1. Do not translate anything, just catch all C++ exception and throw a Python 
RunTimeException.
2. Think about a way to specify a exception translation mechanism in the 
typesystem.

The step 1 will require some changes in the generator, the generator code 
isn't trivial, besides being a bit ugly due to the bad API of ApiExtractor but 
IMO you must try to hack the generator and implement this feature.
 
> Best regards.
> Dennis.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20120430/a03e8025/attachment.sig>


More information about the PySide mailing list