2014-10-09 15:05:19 +02:00
|
|
|
%Module(name=qgis._server,
|
2017-06-25 20:07:14 +10:00
|
|
|
keyword_arguments="All")
|
2014-10-09 15:05:19 +02:00
|
|
|
|
2018-01-10 10:32:21 -04:00
|
|
|
${DEFAULTDOCSTRINGSIGNATURE}
|
2014-10-09 15:05:19 +02:00
|
|
|
|
|
|
|
%Import QtCore/QtCoremod.sip
|
|
|
|
%Import QtGui/QtGuimod.sip
|
|
|
|
%Import QtXml/QtXmlmod.sip
|
|
|
|
|
|
|
|
%Import core/core.sip
|
2019-08-06 16:38:21 +02:00
|
|
|
%Include qgsserverexception.sip
|
2014-10-09 15:05:19 +02:00
|
|
|
|
2015-05-29 10:19:51 +02:00
|
|
|
%Feature HAVE_SERVER_PYTHON_PLUGINS
|
|
|
|
|
2017-06-26 09:57:09 +02:00
|
|
|
%Include server_auto.sip
|
2019-08-06 16:38:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
%VirtualErrorHandler serverapi_badrequest_exception_handler
|
2020-12-01 12:18:31 +01:00
|
|
|
PyObject *type, *exception, *traceback, *pyStrException;
|
|
|
|
|
|
|
|
PyErr_Fetch(&type, &exception, &traceback);
|
|
|
|
pyStrException = PyObject_Str(exception);
|
|
|
|
Py_DECREF(pyStrException);
|
|
|
|
|
2019-08-06 16:38:21 +02:00
|
|
|
SIP_RELEASE_GIL( sipGILState );
|
2020-12-01 12:18:31 +01:00
|
|
|
|
|
|
|
QString strException = "API bad request error";
|
|
|
|
if ( pyStrException && PyUnicode_Check(pyStrException) )
|
2019-08-06 16:38:21 +02:00
|
|
|
{
|
2020-12-01 12:18:31 +01:00
|
|
|
strException = QString::fromUtf8( PyUnicode_AsUTF8(pyStrException) );
|
2019-08-06 16:38:21 +02:00
|
|
|
}
|
2020-12-01 12:18:31 +01:00
|
|
|
|
|
|
|
throw QgsServerApiBadRequestException( strException );
|
2019-08-06 16:38:21 +02:00
|
|
|
%End
|
2019-08-19 16:52:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
%VirtualErrorHandler server_exception_handler
|
2020-12-01 12:18:31 +01:00
|
|
|
PyObject *type, *exception, *traceback, *pyStrException;
|
|
|
|
|
|
|
|
PyErr_Fetch(&type, &exception, &traceback);
|
|
|
|
pyStrException = PyObject_Str(exception);
|
|
|
|
Py_DECREF(pyStrException);
|
|
|
|
|
2019-08-19 16:52:08 +02:00
|
|
|
SIP_RELEASE_GIL( sipGILState );
|
2020-12-01 12:18:31 +01:00
|
|
|
|
|
|
|
QString strException = "Server internal error";
|
|
|
|
if ( pyStrException && PyUnicode_Check(pyStrException) )
|
2019-08-19 16:52:08 +02:00
|
|
|
{
|
2020-12-01 12:18:31 +01:00
|
|
|
strException = QString::fromUtf8( PyUnicode_AsUTF8(pyStrException) );
|
2019-08-19 16:52:08 +02:00
|
|
|
}
|
2020-12-01 12:18:31 +01:00
|
|
|
|
|
|
|
throw QgsServerException( strException );
|
2019-08-19 16:52:08 +02:00
|
|
|
%End
|