userver: /data/code/userver/libraries/proto-structs/src/proto-structs/exceptions.cpp Source File
Loading...
Searching...
No Matches
exceptions.cpp
1#include <userver/proto-structs/exceptions.hpp>
2
3#include <fmt/format.h>
4
5USERVER_NAMESPACE_BEGIN
6
7namespace proto_structs {
8
9ReadError::ReadError(const std::string_view path, const std::string_view reason)
10 : ConversionError(fmt::format("Failed to read protobuf message field '{}' ({})", path, reason))
11{}
12
13WriteError::WriteError(const std::string_view path, const std::string_view reason)
14 : ConversionError(fmt::format("Failed to write protobuf message field '{}' ({})", path, reason))
15{}
16
17OneofAccessError::OneofAccessError(const std::size_t field_idx)
18 : Error(fmt::format("Oneof field is not set (index = {})", field_idx))
19{}
20
21AnyPackError::AnyPackError(const std::string_view message_name)
22 : Error(fmt::format("Failed to pack message '{}' to 'google.protobuf.Any'", message_name))
23{}
24
25AnyUnpackError::AnyUnpackError(const std::string_view message_name)
26 : Error(fmt::format("Failed to unpack message '{}' from 'google.protobuf.Any'", message_name))
27{}
28
29} // namespace proto_structs
30
31USERVER_NAMESPACE_END