10Duke Enterprise C++ SDK
Loading...
Searching...
No Matches
HTTPResponseToException.h
1#ifndef TENDUKE_HTTP_HTTPRESPONSETOEXCEPTION_H
2#define TENDUKE_HTTP_HTTPRESPONSETOEXCEPTION_H
3
4#include "./HTTPResponse.h"
5
6namespace tenduke { namespace http {
7
8
18{
19public:
20 virtual ~HTTPResponseToException() = default;
21
26 virtual void basedOn(tenduke::http::HTTPResponse &response) const;
27
28protected:
34 virtual void fromUnexpectedStatus(tenduke::http::HTTPResponse &response) const;
35
40 virtual void from4xx(tenduke::http::HTTPResponse &response) const;
41
46 virtual void from4xx(int httpStatusCode) const;
47
51 virtual void from400() const;
52
56 virtual void from401() const;
57
61 virtual void from403() const;
62
66 virtual void from404() const;
67
72 virtual void from4xxOther(int httpStatusCode) const;
73
78 virtual void from5xx(tenduke::http::HTTPResponse &response) const;
79
84 virtual void from5xx(int httpStatusCode) const;
85};
86
87}}
88
89
90#endif // TENDUKE_HTTP_HTTPRESPONSETOEXCEPTION_H
Utility service to throw an exception based on tenduke::http::HTTPResponse.
Definition HTTPResponseToException.h:18
virtual void from400() const
Throws exception, when HTTP-status code is 400.
Definition HTTPResponseToException.cpp:75
virtual void basedOn(tenduke::http::HTTPResponse &response) const
Throws exception based on given HTTP response.
Definition HTTPResponseToException.cpp:12
virtual void from401() const
Throws exception, when HTTP-status code is 401.
Definition HTTPResponseToException.cpp:84
virtual void fromUnexpectedStatus(tenduke::http::HTTPResponse &response) const
Throws exception for responses which are neither 4xx nor 5xx, e.g.
Definition HTTPResponseToException.cpp:27
virtual void from5xx(tenduke::http::HTTPResponse &response) const
Throws exception for 5xx responses.
Definition HTTPResponseToException.cpp:51
virtual void from4xxOther(int httpStatusCode) const
Throws exception, when HTTP-status code some other 4xx-series.
Definition HTTPResponseToException.cpp:111
virtual void from403() const
Throws exception, when HTTP-status code is 403.
Definition HTTPResponseToException.cpp:93
virtual void from4xx(tenduke::http::HTTPResponse &response) const
Throws exception for HTTP 4xx responses.
Definition HTTPResponseToException.cpp:45
virtual void from404() const
Throws exception, when HTTP-status code is 404.
Definition HTTPResponseToException.cpp:102
A HTTP Response.
Definition HTTPResponse.h:15
HTTP-related services.
Definition BadRequest.h:6
Root for classes, functions and globals of 10Duke C++ Client.
Definition APIRequest.h:4