24 #ifndef Exception20100812H
25 #define Exception20100812H
27 #include <google/protobuf/descriptor.h>
32 inline std::string exception_string(
const std::string& in,
const google::protobuf::Descriptor* desc,
33 const google::protobuf::FieldDescriptor* field)
37 out += std::string(
"Message: ") + desc->full_name() +
": ";
39 out += std::string(
"Field: ") + field->full_name() +
": ";
49 Exception(
const std::string& s,
const google::protobuf::Descriptor* desc =
nullptr)
50 : std::runtime_error(exception_string(s, desc,
nullptr)), desc_(desc)
54 const google::protobuf::Descriptor* desc()
const {
return desc_; }
57 const google::protobuf::Descriptor* desc_;
71 const google::protobuf::Descriptor* desc =
nullptr)
72 : std::out_of_range(exception_string(s, desc, field)), field_(field), desc_(desc)
76 const google::protobuf::FieldDescriptor* field()
const {
return field_; }
77 const google::protobuf::Descriptor* desc()
const {
return desc_; }
80 const google::protobuf::FieldDescriptor* field_;
81 const google::protobuf::Descriptor* desc_;