[PyQt] Exception: unknown instead of the expected one

Alessandro Pasotti apasotti at gmail.com
Wed Aug 7 09:16:21 BST 2019


Nevermind, my bad: I was throwing "new" exceptions instead of allocating
them on the stack.


On Tue, Aug 6, 2019 at 2:49 PM Alessandro Pasotti <apasotti at gmail.com>
wrote:

> Hi,
>
> I've added an exception in the SIP file:
>
> %Exception QgsProviderConnectionException(SIP_Exception)
> /PyName=QgsProviderConnectionException/
> {
> %TypeHeaderCode
> #include <qgsexception.h>
> %End
> %RaiseCode
>   SIP_BLOCK_THREADS
>   PyErr_SetString(sipException_QgsProviderConnectionException,
> sipExceptionRef.what().toUtf8().constData() );
>   SIP_UNBLOCK_THREADS
> %End
> };
>
> then, in the class method:
>
> virtual void executeSql( const QString &sql) throw(
> QgsProviderConnectionException );
>
> but when calling from Python I always get Exception: unknown, what is
> possible going wrong?
>
> Thanks
>
> --
> Alessandro Pasotti
> w3:   www.itopen.it
>


-- 
Alessandro Pasotti
w3:   www.itopen.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190807/1bbe9890/attachment.html>


More information about the PyQt mailing list