18#ifndef QGSSERVEREXCEPTION_H
19#define QGSSERVEREXCEPTION_H
22#include <nlohmann/json.hpp>
24#include "qgis_server.h"
32using namespace nlohmann;
65 virtual QByteArray formatResponse( QString &responseFormat
SIP_OUT )
const;
92 QString
message()
const {
return mMessage; }
95 QString
code()
const {
return mCode; }
98 QString
locator()
const {
return mLocator; }
103 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 = QStringLiteral(
"The Accept header submitted in the request did not support any of the media types supported by the server for the requested resource" ),
const QString &mimeType = QStringLiteral(
"application/json" ),
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.
QgsOgcServiceException(const QString &code, const QString &message, const QString &locator=QString(), int responseCode=200, const QString &version=QStringLiteral("1.3.0"))
Construction.
QString message() const
Returns the exception message.
QString code() const
Returns the exception code.
QString version() const
Returns the exception version.
QgsServerApiBadRequestException(const QString &message, const QString &mimeType=QStringLiteral("application/json"), int responseCode=400)
Construction.
QgsServerApiException(const QString &code, const QString &message, const QString &mimeType=QStringLiteral("application/json"), int responseCode=200)
Construction.
QByteArray formatResponse(QString &responseFormat) const override
Formats the exception for sending to client.
QgsServerApiInternalServerError(const QString &message=QStringLiteral("Internal server error"), const QString &mimeType=QStringLiteral("application/json"), int responseCode=500)
Construction.
QgsServerApiInvalidMimeTypeException(const QString &message=QStringLiteral("The Accept header submitted in the request did not support any of the media types supported by the server for the requested resource"), const QString &mimeType=QStringLiteral("application/json"), int responseCode=406)
Construction.
QgsServerApiNotFoundError(const QString &message, const QString &mimeType=QStringLiteral("application/json"), int responseCode=404)
Construction.
QgsServerApiNotImplementedException(const QString &message=QStringLiteral("Requested method is not implemented"), const QString &mimeType=QStringLiteral("application/json"), int responseCode=500)
Construction.
QgsServerApiPermissionDeniedException(const QString &message, const QString &mimeType=QStringLiteral("application/json"), 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.