QGIS API Documentation  3.0.2-Girona (307d082)
qgsserverexception.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgserverexception.h
3  ------------------------
4  begin : January 11, 2017
5  copyright : (C) 2017 by David Marteau
6  email : david dot marteau at 3liz dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSSERVEREXCEPTION_H
19 #define QGSSERVEREXCEPTION_H
20 
21 #include <QString>
22 #include <QByteArray>
23 
24 #include "qgsexception.h"
25 #include "qgis_server.h"
26 #include "qgis_sip.h"
27 
28 
36 #ifndef SIP_RUN
37 class SERVER_EXPORT QgsServerException : public QgsException
38 {
39 #else
40 class SERVER_EXPORT QgsServerException
41 {
42 #endif
43  public:
45  QgsServerException( const QString &message, int responseCode = 500 );
46 
50  int responseCode() const { return mResponseCode; }
51 
60  virtual QByteArray formatResponse( QString &responseFormat SIP_OUT ) const;
61 
62  private:
63  int mResponseCode;
64 };
65 
76 #ifndef SIP_RUN
77 class SERVER_EXPORT QgsOgcServiceException : public QgsServerException
78 {
79 #else
80 class SERVER_EXPORT QgsOgcServiceException
81 {
82 #endif
83  public:
85  QgsOgcServiceException( const QString &code, const QString &message, const QString &locator = QString(),
86  int responseCode = 200, const QString &version = QStringLiteral( "1.3.0" ) );
87 
89  QString message() const { return mMessage; }
90 
92  QString code() const { return mCode; }
93 
95  QString locator() const { return mLocator; }
96 
98  QString version() const { return mVersion; }
99 
101  QByteArray formatResponse( QString &responseFormat SIP_OUT ) const override;
102 
103  private:
104  QString mCode;
105  QString mMessage;
106  QString mLocator;
107  QString mVersion;
108 };
109 
110 #endif
111 
Exception base class for service exceptions.
QString version() const
return exception version
Exception base class for server exceptions.
#define SIP_OUT
Definition: qgis_sip.h:51
Defines a QGIS exception class.
Definition: qgsexception.h:34