***UNCHECKED*** Exception: unknown instead of the expected one

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

***UNCHECKED*** Exception: unknown instead of the expected one

Alessandro Pasotti
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

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Exception: unknown instead of the expected one

Alessandro Pasotti
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 <[hidden email]> 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

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt