25 #ifndef Exception20100812H
26 #define Exception20100812H
28 #include <google/protobuf/descriptor.h>
33 inline std::string exception_string(
const std::string& in,
const google::protobuf::Descriptor* desc,
34 const google::protobuf::FieldDescriptor* field)
38 out += std::string(
"Message: ") + desc->full_name() +
": ";
40 out += std::string(
"Field: ") + field->full_name() +
": ";
50 Exception(
const std::string& s,
const google::protobuf::Descriptor* desc =
nullptr)
51 : std::runtime_error(exception_string(s, desc,
nullptr)), desc_(desc)
55 const google::protobuf::Descriptor* desc()
const {
return desc_; }
58 const google::protobuf::Descriptor* desc_;
72 const google::protobuf::Descriptor* desc =
nullptr)
73 : std::out_of_range(exception_string(s, desc, field)), field_(field), desc_(desc)
77 const google::protobuf::FieldDescriptor* field()
const {
return field_; }
78 const google::protobuf::Descriptor* desc()
const {
return desc_; }
81 const google::protobuf::FieldDescriptor* field_;
82 const google::protobuf::Descriptor* desc_;