[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] Exception: unknown instead of the expected one
From: Alessandro Pasotti <apasotti () gmail ! com>
Date: 2019-08-07 8:16:21
Message-ID: CAL5Q671JMFdNT6d_gxED8yMXo+6hp5MZd3YeSRM572RfGjR=Sw () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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@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
[Attachment #5 (text/html)]
<div dir="ltr"><div>Nevermind, my bad: I was throwing "new" exceptions instead of \
allocating them on the stack.</div><div></div><div dir="ltr"><br></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 6, 2019 at 2:49 PM Alessandro \
Pasotti <<a href="mailto:apasotti@gmail.com">apasotti@gmail.com</a>> \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px \
solid rgb(204,204,204);padding-left:1ex"><div \
dir="ltr"><div>Hi,</div><div><br></div><div>I've added an exception in the SIP \
file:<br></div><div><br></div><div>%Exception QgsProviderConnectionException(SIP_Exception) \
/PyName=QgsProviderConnectionException/<br>{<br>%TypeHeaderCode<br>#include \
<qgsexception.h><br>%End<br>%RaiseCode<br> SIP_BLOCK_THREADS<br> \
PyErr_SetString(sipException_QgsProviderConnectionException, \
sipExceptionRef.what().toUtf8().constData() );<br> \
SIP_UNBLOCK_THREADS<br>%End<br>};</div><div><br></div><div>then, in the class \
method:</div><div><br></div><div>virtual void executeSql( const QString &sql) throw( \
QgsProviderConnectionException );</div><div><br></div><div>but when calling from Python I \
always get Exception: unknown, what is possible going \
wrong?</div><div><br></div><div>Thanks</div><div><br></div><div>-- <br><div dir="ltr" \
class="gmail-m_-1953814426991502971gmail_signature">Alessandro Pasotti<br>w3: <a \
href="http://www.itopen.it" target="_blank">www.itopen.it</a></div></div></div> \
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">Alessandro \
Pasotti<br>w3: <a href="http://www.itopen.it" target="_blank">www.itopen.it</a></div></div>
[Attachment #6 (text/plain)]
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic