diff --git a/parser/common/convert/message2operator.cc b/parser/common/convert/message2operator.cc index 3b0c96f..34fc664 100644 --- a/parser/common/convert/message2operator.cc +++ b/parser/common/convert/message2operator.cc @@ -58,7 +58,7 @@ Status Message2Operator::ParseOperatorAttrs(const google::protobuf::Message *mes return SUCCESS; } -void Message2Operator::ParseBaseTypeField(const google::protobuf::Reflection *reflection, +Status Message2Operator::ParseBaseTypeField(const google::protobuf::Reflection *reflection, const google::protobuf::Message *message, const google::protobuf::FieldDescriptor *field, ge::Operator &ops) { switch (field->cpp_type()) { @@ -93,16 +93,18 @@ void Message2Operator::ParseBaseTypeField(const google::protobuf::Reflection *re break; } default: { - break; + return FAILED; } } + return SUCCESS; } Status Message2Operator::ParseField(const google::protobuf::Reflection *reflection, const google::protobuf::Message *message, const google::protobuf::FieldDescriptor *field, int depth, ge::Operator &ops) { GELOGD("Start to parse field: %s.", field->name().c_str()); - ParseBaseTypeField(reflection, message, field, ops); + GE_CHK_BOOL_RET_STATUS(ParseBaseTypeField(reflection, message, field, ops) == FAILED, SUCCESS, + "Parse field: %s success.", field->name().c_str()); switch (field->cpp_type()) { case google::protobuf::FieldDescriptor::CPPTYPE_ENUM: { GE_CHECK_NOTNULL(reflection->GetEnum(*message, field)); @@ -136,7 +138,7 @@ Status Message2Operator::ParseField(const google::protobuf::Reflection *reflecti return SUCCESS; } -void Message2Operator::ParseRepeatedBaseTypeField(const google::protobuf::Reflection *reflection, +Status Message2Operator::ParseRepeatedBaseTypeField(const google::protobuf::Reflection *reflection, const google::protobuf::Message *message, const google::protobuf::FieldDescriptor *field, ge::Operator &ops, const int field_size) { @@ -196,9 +198,10 @@ void Message2Operator::ParseRepeatedBaseTypeField(const google::protobuf::Reflec break; } default: { - break; + return FAILED; } } + return SUCCESS; } Status Message2Operator::ParseRepeatedField(const google::protobuf::Reflection *reflection, @@ -212,8 +215,8 @@ Status Message2Operator::ParseRepeatedField(const google::protobuf::Reflection * GELOGE(FAILED, "[Check][Size]Size of repeated field %s must bigger than 0", field->name().c_str()); return FAILED; } - - ParseRepeatedBaseTypeField(reflection, message, field, ops, field_size); + GE_CHK_BOOL_RET_STATUS(ParseRepeatedBaseTypeField(reflection, message, field, ops, field_size) == FAILED, SUCCESS, + "Parse repeated field: %s success.", field->name().c_str()); switch (field->cpp_type()) { case google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE: { nlohmann::json message_json; diff --git a/parser/common/convert/message2operator.h b/parser/common/convert/message2operator.h index a1810cb..cbf885d 100644 --- a/parser/common/convert/message2operator.h +++ b/parser/common/convert/message2operator.h @@ -34,14 +34,14 @@ class Message2Operator { const google::protobuf::Message *message, const google::protobuf::FieldDescriptor *field, ge::Operator &ops); - static void ParseBaseTypeField(const google::protobuf::Reflection *reflection, - const google::protobuf::Message *message, - const google::protobuf::FieldDescriptor *field, ge::Operator &ops); + static Status ParseBaseTypeField(const google::protobuf::Reflection *reflection, + const google::protobuf::Message *message, + const google::protobuf::FieldDescriptor *field, ge::Operator &ops); - static void ParseRepeatedBaseTypeField(const google::protobuf::Reflection *reflection, - const google::protobuf::Message *message, - const google::protobuf::FieldDescriptor *field, - ge::Operator &ops, const int field_size); + static Status ParseRepeatedBaseTypeField(const google::protobuf::Reflection *reflection, + const google::protobuf::Message *message, + const google::protobuf::FieldDescriptor *field, + ge::Operator &ops, const int field_size); }; } // namespace ge #endif // PARSER_MESSAGE2OPERATOR_H