10Duke Scale C++ Client
Loading...
Searching...
No Matches
APIException.h
1#ifndef TENDUKE_SE_APIEXCEPTION_H
2#define TENDUKE_SE_APIEXCEPTION_H
3
4#include "http/HTTPResponseException.h"
5
6#include <utility>
7
8
9namespace tenduke { namespace se { namespace http {
10
15{
16public:
24 const int code
25 , std::string error
26 , const std::string &description
27 ) : tenduke::http::HTTPResponseException(code, description)
28 , error(std::move(error))
29 {}
30
37 const int code
38 , const std::string &description
39 ) : APIException(code, "", description)
40 {}
41
46 explicit APIException(const int code) : APIException(code, "", "")
47 {}
48
53 std::string getError()
54 const
55 {
56 return error;
57 }
58
63 std::string getDescription()
64 const
65 {
66 return std::runtime_error::what();
67 }
68
69private:
70 const std::string error;
71};
72
73}}}
74
75
76#endif //TENDUKE_SE_APIEXCEPTION_H
This exception is thrown when HTTP-request fails because of HTTP-statuscode.
Definition HTTPResponseException.h:14
HTTPResponseException(int httpStatusCode, const std::string &message)
Constructs new instance.
Definition HTTPResponseException.h:21
Base class for exceptions, which are mapped from HTTP-status-codes from 10Duke Scale backend.
Definition APIException.h:15
APIException(const int code, const std::string &description)
Constructs new instance with HTTP status code and description.
Definition APIException.h:36
APIException(const int code)
Constructs new instance just with HTTP status code.
Definition APIException.h:46
std::string getError() const
Returns the error code.
Definition APIException.h:53
APIException(const int code, std::string error, const std::string &description)
Constructs new instance with HTTP status code, error code and description.
Definition APIException.h:23
std::string getDescription() const
Returns the description.
Definition APIException.h:63
Root for classes, functions and globals of 10Duke C++ Client.
Definition BackendConfiguration.h:7