userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
exceptions.hpp
Go to the documentation of this file.
1
#pragma once
2
5
6
#include <cstdint>
7
#include <exception>
8
#include <map>
9
#include <stdexcept>
10
#include <string>
11
#include <string_view>
12
13
USERVER_NAMESPACE_BEGIN
14
15
namespace
kafka {
16
19
class
SendException :
public
std::runtime_error {
20
public
:
21
using
std::runtime_error::runtime_error;
22
27
bool
IsRetryable
() const noexcept;
28
29
protected:
30
SendException(const
char
* what,
bool
is_retryable);
31
32
private:
33
const
bool
is_retryable_{
false
};
34
};
35
38
class
BulkSendException :
public
std::runtime_error {
39
static
constexpr
const
char
* kWhat{
"Some messages was not delivered."
};
40
41
public
:
42
using
ExceptionMap = std::map<std::size_t, std::exception_ptr>;
43
44
explicit
BulkSendException(ExceptionMap nested_exceptions);
45
48
const
ExceptionMap&
GetExceptions
() const noexcept;
49
50
private:
56
const ExceptionMap nested_exceptions_;
57
};
58
59
class DeliveryTimeoutException final : public SendException {
60
static
constexpr
const
char
* kWhat{
61
"Message is not delivered after `delivery_timeout` milliseconds. Hint: "
62
"Adjust `delivery_timeout` and `queue_buffering_*` options or manually "
63
"retry the send request."
64
};
65
66
public
:
67
DeliveryTimeoutException();
68
};
69
70
class
QueueFullException final :
public
SendException {
71
static
constexpr
const
char
* kWhat{
72
"The sending queue is full - send request cannot be scheduled. Hint: "
73
"Manually retry the error or increase `queue_buffering_max_messages` "
74
"and/or `queue_buffering_max_kbytes` config option."
75
};
76
77
public
:
78
QueueFullException();
79
};
80
81
class
MessageTooLargeException final :
public
SendException {
82
static
constexpr
const
char
* kWhat{
83
"Message size exceeds configured limit. Hint: increase "
84
"`message_max_bytes` config option."
85
};
86
87
public
:
88
MessageTooLargeException();
89
};
90
91
class
UnknownTopicException final :
public
SendException {
92
static
constexpr
const
char
* kWhat{
"Given topic does not exist in cluster."
};
93
94
public
:
95
UnknownTopicException();
96
};
97
98
class
UnknownPartitionException final :
public
SendException {
99
static
constexpr
const
char
* kWhat =
"Topic does not have given partition."
;
100
101
public
:
102
UnknownPartitionException();
103
};
104
106
class
OffsetRangeException :
public
std::runtime_error {
107
public
:
108
using
std::runtime_error::runtime_error;
109
110
OffsetRangeException(std::string_view what, std::string_view topic, std::uint32_t partition);
111
};
112
113
class
OffsetRangeTimeoutException final :
public
OffsetRangeException {
114
static
constexpr
const
char
* kWhat =
"Timeout while fetching offsets."
;
115
116
public
:
117
OffsetRangeTimeoutException(std::string_view topic, std::uint32_t partition);
118
};
119
120
class
TopicNotFoundException
final :
public
std::runtime_error {
121
public
:
122
using
std::runtime_error::runtime_error;
123
};
124
126
class
GetMetadataException :
public
std::runtime_error {
127
public
:
128
using
std::runtime_error::runtime_error;
129
130
GetMetadataException(std::string_view what, std::string_view topic);
131
};
132
133
class
GetMetadataTimeoutException final :
public
GetMetadataException {
134
static
constexpr
const
char
* kWhat =
"Timeout while getting metadata."
;
135
136
public
:
137
GetMetadataTimeoutException(std::string_view topic);
138
};
139
142
class
ParseHeadersException final : std::runtime_error {
143
static
constexpr
const
char
* kWhat =
"Failed to parse headers"
;
144
145
public
:
146
ParseHeadersException(std::string_view error);
147
};
148
153
class
SeekException
final :
public
std::runtime_error {
154
public
:
155
using
std::runtime_error::runtime_error;
156
};
157
162
class
SeekInvalidArgumentException
final :
public
std::invalid_argument {
163
public
:
164
using
std::invalid_argument::invalid_argument;
165
};
166
168
class
ConsumerRestartRequiredException final :
public
std::runtime_error {
169
public
:
170
explicit
ConsumerRestartRequiredException(
const
std::string& message);
171
};
172
173
}
// namespace kafka
174
175
USERVER_NAMESPACE_END
userver
kafka
exceptions.hpp
Generated on
for userver by
Doxygen
1.17.0