Skip to content

Commit

Permalink
Rename variable for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 16, 2024
1 parent 0039239 commit 75758df
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
20 changes: 10 additions & 10 deletions python/PyQt6/server/server.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@ ${DEFAULTDOCSTRINGSIGNATURE}

PyErr_Fetch(&type, &exception, &traceback);
// check whether the object is already a unicode string
QString pyStrException;
QString originalExceptionMessage;
if ( PyUnicode_Check( exception) )
{
pyStrException = QString::fromUtf8( PyUnicode_AsUTF8( exception ) );
originalExceptionMessage = QString::fromUtf8( PyUnicode_AsUTF8( exception ) );
}
else
{
PyObject* str = PyObject_Str( exception );
pyStrException = QString::fromUtf8( PyUnicode_AsUTF8( str ) );
originalExceptionMessage = QString::fromUtf8( PyUnicode_AsUTF8( str ) );
Py_XDECREF( str );
}

SIP_RELEASE_GIL( sipGILState );

QString strException = "API bad request error";
if ( !pyStrException.isEmpty() )
if ( !originalExceptionMessage.isEmpty() )
{
strException = pyStrException;
strException = originalExceptionMessage;
}

throw QgsServerApiBadRequestException( strException );
Expand All @@ -50,24 +50,24 @@ ${DEFAULTDOCSTRINGSIGNATURE}

PyErr_Fetch(&type, &exception, &traceback);
// check whether the object is already a unicode string
QString pyStrException;
QString originalExceptionMessage;
if ( PyUnicode_Check( exception) )
{
pyStrException = QString::fromUtf8( PyUnicode_AsUTF8( exception ) );
originalExceptionMessage = QString::fromUtf8( PyUnicode_AsUTF8( exception ) );
}
else
{
PyObject* str = PyObject_Str( exception );
pyStrException = QString::fromUtf8( PyUnicode_AsUTF8( str ) );
originalExceptionMessage = QString::fromUtf8( PyUnicode_AsUTF8( str ) );
Py_XDECREF( str );
}

SIP_RELEASE_GIL( sipGILState );

QString strException = "Server internal error";
if ( !pyStrException.isEmpty() )
if ( !originalExceptionMessage.isEmpty() )
{
strException = pyStrException;
strException = originalExceptionMessage;
}

throw QgsServerException( strException );
Expand Down
20 changes: 10 additions & 10 deletions python/server/server.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ ${DEFAULTDOCSTRINGSIGNATURE}

PyErr_Fetch(&type, &exception, &traceback);
// check whether the object is already a unicode string
QString pyStrException;
QString originalExceptionMessage;
if ( PyUnicode_Check( exception) )
{
pyStrException = QString::fromUtf8( PyUnicode_AsUTF8( exception ) );
originalExceptionMessage = QString::fromUtf8( PyUnicode_AsUTF8( exception ) );
}
else
{
PyObject* str = PyObject_Str( exception );
pyStrException = QString::fromUtf8( PyUnicode_AsUTF8( str ) );
originalExceptionMessage = QString::fromUtf8( PyUnicode_AsUTF8( str ) );
Py_XDECREF( str );
}

SIP_RELEASE_GIL( sipGILState );

QString strException = "API bad request error";
if ( !pyStrException.isEmpty() )
if ( !originalExceptionMessage.isEmpty() )
{
strException = pyStrException;
strException = originalExceptionMessage;
}

throw QgsServerApiBadRequestException( strException );
Expand All @@ -49,24 +49,24 @@ ${DEFAULTDOCSTRINGSIGNATURE}

PyErr_Fetch(&type, &exception, &traceback);
// check whether the object is already a unicode string
QString pyStrException;
QString originalExceptionMessage;
if ( PyUnicode_Check( exception) )
{
pyStrException = QString::fromUtf8( PyUnicode_AsUTF8( exception ) );
originalExceptionMessage = QString::fromUtf8( PyUnicode_AsUTF8( exception ) );
}
else
{
PyObject* str = PyObject_Str( exception );
pyStrException = QString::fromUtf8( PyUnicode_AsUTF8( str ) );
originalExceptionMessage = QString::fromUtf8( PyUnicode_AsUTF8( str ) );
Py_XDECREF( str );
}

SIP_RELEASE_GIL( sipGILState );

QString strException = "Server internal error";
if ( !pyStrException.isEmpty() )
if ( !originalExceptionMessage.isEmpty() )
{
strException = pyStrException;
strException = originalExceptionMessage;
}

throw QgsServerException( strException );
Expand Down

0 comments on commit 75758df

Please sign in to comment.