userver
C++ Async Framework
Loading...
Searching...
No Matches
status_codes.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/ugrpc/status_codes.hpp
4
/// @brief Utilities for grpc::StatusCode
5
6
#
include
<
grpcpp
/
support
/
status
.
h
>
7
8
USERVER_NAMESPACE_BEGIN
9
10
namespace
ugrpc {
11
12
/// @brief Convert string to grpc::StatusCode
13
/// @throws std::runtime_error
14
grpc::StatusCode
StatusCodeFromString
(std::string_view str);
15
16
/// @brief Convert grpc::StatusCode to string
17
std
::
string_view
ToString
(
grpc
::
StatusCode
code
)
noexcept
;
18
19
/// @brief Whether a given status code is definitely a server-side error
20
///
21
/// Currently includes:
22
///
23
/// * `UNKNOWN`
24
/// * `UNIMPLEMENTED`
25
/// * `INTERNAL`
26
/// * `UNAVAILABLE`
27
/// * `DATA_LOSS`
28
///
29
/// We intentionally do not include `CANCELLED` and `DEADLINE_EXPIRED` here, because the situation may either be
30
/// considered not erroneous at all (when a client explicitly cancels an RPC; when a client attempts an RPC with a very
31
/// short deadline), or there is no single obvious service to blame (when the collective deadline expires for an RPC
32
/// tree).
33
bool
IsServerError
(grpc::StatusCode code)
noexcept
;
34
35
}
// namespace ugrpc
36
37
USERVER_NAMESPACE_END
userver
ugrpc
status_codes.hpp
Generated on Tue Nov 19 2024 11:30:47 for userver by
Doxygen
1.10.0