userver
C++ Async Framework
Loading...
Searching...
No Matches
exceptions.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/ugrpc/client/exceptions.hpp
4
/// @brief Exceptions thrown by gRPC client streams
5
6
#
include
<
exception
>
7
#
include
<
string
>
8
#
include
<
string_view
>
9
10
#
include
<
grpcpp
/
support
/
status
.
h
>
11
12
USERVER_NAMESPACE_BEGIN
13
14
/// Asynchronous gRPC driver
15
namespace
ugrpc {}
16
17
/// Client-side utilities
18
namespace
ugrpc::client {
19
20
/// @brief Base exception for all the client errors
21
class
BaseError
:
public
std
::
exception
{
22
public
:
23
explicit
BaseError(std::string message);
24
25
const
char
* what()
const
noexcept
override;
26
27
private
:
28
std::string message_;
29
};
30
31
/// @brief Error during an RPC
32
class
RpcError
:
public
BaseError
{
33
public
:
34
RpcError(std::string_view call_name, std::string_view additional_info);
35
};
36
37
/// @brief RPC failed without a status. This means that either the call got
38
/// cancelled using `TryCancel` or the channel is broken.
39
/// Note: Deadline expiration throws @ref ugrpc::client::DeadlineExceededError
40
class
RpcInterruptedError
final
:
public
RpcError
{
41
public
:
42
RpcInterruptedError(std::string_view call_name, std::string_view stage);
43
};
44
45
/// @brief RPC failed due to task cancellation
46
class
RpcCancelledError
final
:
public
RpcError
{
47
public
:
48
RpcCancelledError(std::string_view call_name, std::string_view stage);
49
};
50
51
/// @brief Error with grpc::Status details
52
/// @see <grpcpp/impl/codegen/status_code_enum.h> for error code details
53
class
ErrorWithStatus
:
public
RpcError
{
54
public
:
55
ErrorWithStatus(std::string_view call_name, grpc::Status&& status);
56
57
const
grpc::Status& GetStatus()
const
noexcept
;
58
59
private
:
60
grpc::Status status_;
61
};
62
63
/// @brief Concrete errors for all the error codes
64
/// @see <grpcpp/impl/codegen/status_code_enum.h> for error code details
65
/// @{
66
class
CancelledError
final
:
public
ErrorWithStatus
{
67
public
:
68
using
ErrorWithStatus
::ErrorWithStatus;
69
};
70
71
class
UnknownError
final
:
public
ErrorWithStatus
{
72
public
:
73
using
ErrorWithStatus
::ErrorWithStatus;
74
};
75
76
class
InvalidArgumentError
final
:
public
ErrorWithStatus
{
77
public
:
78
using
ErrorWithStatus
::ErrorWithStatus;
79
};
80
81
class
DeadlineExceededError
final
:
public
ErrorWithStatus
{
82
public
:
83
using
ErrorWithStatus
::ErrorWithStatus;
84
};
85
86
class
NotFoundError
final
:
public
ErrorWithStatus
{
87
public
:
88
using
ErrorWithStatus
::ErrorWithStatus;
89
};
90
91
class
AlreadyExistsError
final
:
public
ErrorWithStatus
{
92
public
:
93
using
ErrorWithStatus
::ErrorWithStatus;
94
};
95
96
class
PermissionDeniedError
final
:
public
ErrorWithStatus
{
97
public
:
98
using
ErrorWithStatus
::ErrorWithStatus;
99
};
100
101
class
ResourceExhaustedError
final
:
public
ErrorWithStatus
{
102
public
:
103
using
ErrorWithStatus
::ErrorWithStatus;
104
};
105
106
class
FailedPreconditionError
final
:
public
ErrorWithStatus
{
107
public
:
108
using
ErrorWithStatus
::ErrorWithStatus;
109
};
110
111
class
AbortedError
final
:
public
ErrorWithStatus
{
112
public
:
113
using
ErrorWithStatus
::ErrorWithStatus;
114
};
115
116
class
OutOfRangeError
final
:
public
ErrorWithStatus
{
117
public
:
118
using
ErrorWithStatus
::ErrorWithStatus;
119
};
120
121
class
UnimplementedError
final
:
public
ErrorWithStatus
{
122
public
:
123
using
ErrorWithStatus
::ErrorWithStatus;
124
};
125
126
class
InternalError
final
:
public
ErrorWithStatus
{
127
public
:
128
using
ErrorWithStatus
::ErrorWithStatus;
129
};
130
131
class
UnavailableError
final
:
public
ErrorWithStatus
{
132
public
:
133
using
ErrorWithStatus
::ErrorWithStatus;
134
};
135
136
class
DataLossError
final
:
public
ErrorWithStatus
{
137
public
:
138
using
ErrorWithStatus
::ErrorWithStatus;
139
};
140
141
class
UnauthenticatedError
final
:
public
ErrorWithStatus
{
142
public
:
143
using
ErrorWithStatus
::ErrorWithStatus;
144
};
145
/// @}
146
147
[[noreturn]]
void
ThrowErrorWithStatus(std::string_view call_name, grpc::Status&& status);
148
149
}
// namespace ugrpc::client
150
151
USERVER_NAMESPACE_END
userver
ugrpc
client
exceptions.hpp
Generated on Tue Jan 27 2026 16:42:39 for userver by
Doxygen
1.13.2