18#ifndef QGSSERVEREXCEPTION_H
19#define QGSSERVEREXCEPTION_H
22#include <nlohmann/json.hpp>
24#include "qgis_server.h"
32using namespace Qt::StringLiterals;
33using namespace nlohmann;
66 virtual QByteArray formatResponse( QString &responseFormat
SIP_OUT )
const;
93 QString
message()
const {
return mMessage; }
96 QString
code()
const {
return mCode; }
99 QString
locator()
const {
return mLocator; }
104 QByteArray formatResponse( QString &responseFormat
SIP_OUT )
const override;
154 , mMimeType( mimeType )
160 responseFormat = mMimeType;
163 {
"code", mCode.toStdString() },
164 {
"description",
what().toStdString() },
168 return QByteArray::fromStdString( data.dump() );
315 QgsServerApiInvalidMimeTypeException(
const QString &message = u
"The Accept header submitted in the request did not support any of the media types supported by the server for the requested resource"_s,
const QString &mimeType = u
"application/json"_s,
int responseCode = 406 )
QgsBadRequestException(const QString &code, const QString &message, const QString &locator=QString())
Constructor for QgsBadRequestException (HTTP error code 400).
QgsException(const QString &message)
Constructor for QgsException, with the specified error message.
QString locator() const
Returns the locator.
QString message() const
Returns the exception message.
QString code() const
Returns the exception code.
QString version() const
Returns the exception version.
QgsOgcServiceException(const QString &code, const QString &message, const QString &locator=QString(), int responseCode=200, const QString &version=u"1.3.0"_s)
Construction.
QgsServerApiBadRequestException(const QString &message, const QString &mimeType=u"application/json"_s, int responseCode=400)
Construction.
QgsServerApiException(const QString &code, const QString &message, const QString &mimeType=u"application/json"_s, int responseCode=200)
Construction.
QByteArray formatResponse(QString &responseFormat) const override
Formats the exception for sending to client.
QgsServerApiInternalServerError(const QString &message=u"Internal server error"_s, const QString &mimeType=u"application/json"_s, int responseCode=500)
Construction.
QgsServerApiInvalidMimeTypeException(const QString &message=u"The Accept header submitted in the request did not support any of the media types supported by the server for the requested resource"_s, const QString &mimeType=u"application/json"_s, int responseCode=406)
Construction.
QgsServerApiNotFoundError(const QString &message, const QString &mimeType=u"application/json"_s, int responseCode=404)
Construction.
QgsServerApiNotImplementedException(const QString &message=u"Requested method is not implemented"_s, const QString &mimeType=u"application/json"_s, int responseCode=500)
Construction.
QgsServerApiPermissionDeniedException(const QString &message, const QString &mimeType=u"application/json"_s, int responseCode=403)
Construction.
int responseCode() const
Returns the return HTTP response code associated with this exception.
QgsServerException(const QString &message, int responseCode=500)
Constructor.