userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
error.hpp
Go to the documentation of this file.
1
#pragma once
2
5
6
#include <exception>
7
#include <string>
8
#include <string_view>
9
#include <system_error>
10
11
#include <
userver/clients/http/error_kind.hpp
>
12
#include <
userver/clients/http/local_stats.hpp
>
13
14
USERVER_NAMESPACE_BEGIN
15
16
namespace
clients::http
{
17
19
class
BaseException :
public
std::exception {
20
public
:
21
BaseException(std::string message,
const
LocalStats
& stats,
ErrorKind
error_kind)
22
: message_(std::move(message)),
23
stats_(stats),
24
error_kind_(error_kind)
25
{}
26
~BaseException()
override
=
default
;
27
28
const
char
* what()
const
noexcept
override
{
return
message_.c_str(); }
29
30
ErrorKind
GetErrorKind()
const
{
return
error_kind_; }
31
32
const
LocalStats
& GetStats()
const
{
return
stats_; }
33
34
private
:
35
std::string message_;
36
LocalStats
stats_;
37
ErrorKind
error_kind_;
38
};
39
41
class
BaseCodeException :
public
BaseException {
42
public
:
43
BaseCodeException(std::error_code ec, std::string_view message, std::string_view url,
const
LocalStats
& stats);
44
~BaseCodeException()
override
=
default
;
45
46
const
std::error_code& error_code()
const
noexcept
{
return
ec_; }
47
48
private
:
49
std::error_code ec_;
50
};
51
52
class
TimeoutException :
public
BaseException {
53
public
:
54
TimeoutException(std::string_view message,
const
LocalStats
& stats);
55
~TimeoutException()
override
=
default
;
56
};
57
58
class
CancelException
:
public
BaseException {
59
public
:
60
using
BaseException::BaseException;
61
~CancelException
()
override
=
default
;
62
};
63
64
class
SSLException
:
public
BaseCodeException {
65
public
:
66
using
BaseCodeException::BaseCodeException;
67
~SSLException
()
override
=
default
;
68
};
69
70
class
TechnicalError
:
public
BaseCodeException {
71
public
:
72
using
BaseCodeException::BaseCodeException;
73
~TechnicalError
()
override
=
default
;
74
};
75
76
class
BadArgumentException
:
public
BaseCodeException {
77
public
:
78
using
BaseCodeException::BaseCodeException;
79
~BadArgumentException
()
override
=
default
;
80
};
81
82
class
TooManyRedirectsException
:
public
BaseCodeException {
83
public
:
84
using
BaseCodeException::BaseCodeException;
85
~TooManyRedirectsException
()
override
=
default
;
86
};
87
88
class
NetworkProblemException
:
public
BaseCodeException {
89
public
:
90
using
BaseCodeException::BaseCodeException;
91
~NetworkProblemException
()
override
=
default
;
92
};
93
94
class
DNSProblemException
:
public
BaseCodeException {
95
public
:
96
using
BaseCodeException::BaseCodeException;
97
~DNSProblemException
()
override
=
default
;
98
};
99
100
class
AuthFailedException
:
public
BaseCodeException {
101
public
:
102
using
BaseCodeException::BaseCodeException;
103
~AuthFailedException
()
override
=
default
;
104
};
105
107
class
HttpException :
public
BaseException {
108
public
:
109
HttpException(
int
code,
const
LocalStats
& stats, std::string_view message,
ErrorKind
error_kind);
110
~HttpException()
override
=
default
;
111
112
int
code()
const
{
return
code_; }
113
114
private
:
115
int
code_;
116
};
117
118
class
HttpClientException :
public
HttpException {
119
public
:
120
HttpClientException(
int
code,
const
LocalStats
& stats);
121
HttpClientException(
int
code,
const
LocalStats
& stats, std::string_view message);
122
~HttpClientException()
override
=
default
;
123
};
124
125
class
HttpServerException :
public
HttpException {
126
public
:
127
HttpServerException(
int
code,
const
LocalStats
& stats);
128
HttpServerException(
int
code,
const
LocalStats
& stats, std::string_view message);
129
~HttpServerException()
override
=
default
;
130
};
131
133
std::exception_ptr
PrepareException
(std::error_code ec, std::string_view url,
const
LocalStats
& stats);
134
135
}
// namespace clients::http
136
137
USERVER_NAMESPACE_END
userver
clients
http
error.hpp
Generated on
for userver by
Doxygen
1.17.0