userver: userver/ugrpc/server/exceptions.hpp Source File
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
exceptions.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/ugrpc/server/exceptions.hpp
4/// @brief Errors thrown by gRPC server streams
5
6#include <exception>
7#include <string>
8#include <string_view>
9
10USERVER_NAMESPACE_BEGIN
11
12/// Server-side utilities
13namespace ugrpc::server {
14
15/// @brief Base exception for all the server errors
16class BaseError : public std::exception {
17 public:
18 explicit BaseError(std::string message);
19
20 const char* what() const noexcept override;
21
22 private:
23 std::string message_;
24};
25
26/// @brief Error during an RPC
27class RpcError : public BaseError {
28 public:
29 RpcError(std::string_view call_name, std::string_view additional_info);
30};
31
32/// @brief RPC failed without a status. This means that either the call got
33/// cancelled using `TryCancel`, the deadline has expired, or the client
34/// disconnected.
36 public:
37 RpcInterruptedError(std::string_view call_name, std::string_view stage);
38};
39
40} // namespace ugrpc::server
41
42USERVER_NAMESPACE_END