[PyQt] Problem with exception translation
meine at informatik.uni-hamburg.de
Thu Sep 9 14:59:04 BST 2010
I have had many problems with exception translation. First of all, it seems
to be an undocumented fact that the exception translation is overwritten by
%MethodCode blocks (i.e. not wrapped around them).
Second, even after enabling exception translation by passing -e and describing
my exception (or std::exception, which is the base class) using an %Exception
block, it is not caught anywhere, obviously because I have no throw(...)
clauses. (Luckily, I later found /Default/, see below.)
Third, I have had problems when trying to add throw(...) clauses, i.e. I have
class Foo : QObject
void test() throw (std::exception);
const char *detail = sipExceptionRef.what();
But I am getting:
sip: ..:14: There is already a class or namespace in scope with the same
Ah! The error goes away when I swap the two declarations, i.e. move the
%Exception block above.
Anyhow, now I found the /Default/ annotation, which is exactly what I want.
However, I get compile errors from the generated code; obviously, the above
%TypeHeaderCode is not inserted into every file using the above default-catch
block, so #include <exception> is missing and the build fails.
At least the latter seems to be a clear bug to me, no?
Have a nice day,
More information about the PyQt