1#include <userver/protobuf/json/exceptions.hpp>
9namespace protobuf::
json {
13template <
typename TErrorCode>
14[[nodiscard]]
constexpr const char* GetConversionErrorCodeStr(
const TErrorCode code)
noexcept {
15 if constexpr (std::is_same_v<TErrorCode, ReadErrorCode>) {
17 case TErrorCode::kUnknownField:
18 return "unknown field";
19 case TErrorCode::kUnknownEnum:
20 return "unknown enum";
21 case TErrorCode::kMultipleOneofFields:
22 return "multiple oneof fields";
23 case TErrorCode::kInvalidType:
24 return "invalid type";
25 case TErrorCode::kInvalidValue:
26 return "invalid value";
32 case TErrorCode::kInvalidValue:
33 return "invalid value";
40template <
typename TErrorCode>
41[[nodiscard]]
constexpr const char* GetConversionErrorDescription()
noexcept {
42 if constexpr (std::is_same_v<TErrorCode, ReadErrorCode>) {
43 return "Failed to convert JSON field '{}' with error '{}'";
45 return "Failed to convert protobuf message field '{}' with error '{}'";