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
12WriteError::WriteError(const std::string_view path, const std::string_view reason)
13 : ConversionError(fmt::format("Failed to write protobuf message field '{}' ({})", path, reason)) {}
14
15OneofAccessError::OneofAccessError(const std::size_t field_idx)
16 : Error(fmt::format("Oneof field is not set (index = {})", field_idx)) {}
17
18AnyPackError::AnyPackError(const std::string_view message_name)
19 : Error(fmt::format("Failed to pack message '{}' to 'google.protobuf.Any'", message_name)) {}
20
21AnyUnpackError::AnyUnpackError(const std::string_view message_name)
22 : Error(fmt::format("Failed to unpack message '{}' from 'google.protobuf.Any'", message_name)) {}
23
24} // namespace proto_structs
25
26USERVER_NAMESPACE_END