You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/04/25 23:32:21 UTC
[28/50] mesos git commit: Fixed protobuf::parse to surface nested
message parsing errors.
Fixed protobuf::parse to surface nested message parsing errors.
Previously, errors parsing nested messages were ignored.
Review: https://reviews.apache.org/r/42167/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/50c0b358
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/50c0b358
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/50c0b358
Branch: refs/heads/0.26.x
Commit: 50c0b358a1b35ac5004f20794bd2348daeab6c24
Parents: e8a2459
Author: Gilbert Song <so...@gmail.com>
Authored: Mon Jan 11 16:54:40 2016 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Fri Feb 26 20:59:06 2016 -0800
----------------------------------------------------------------------
.../3rdparty/stout/include/stout/protobuf.hpp | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/50c0b358/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp
index 085da00..31f51ba 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp
@@ -334,10 +334,25 @@ struct Parser : boost::static_visitor<Try<Nothing> >
{
switch (field->type()) {
case google::protobuf::FieldDescriptor::TYPE_MESSAGE:
+ // TODO(gilbert): We currently push up the nested error
+ // messages without wrapping the error message (due to
+ // the recursive nature of parse). We should pass along
+ // variable information in order to construct a helpful
+ // error message, e.g. "Failed to parse field 'a.b.c': ...".
if (field->is_repeated()) {
- parse(reflection->AddMessage(message, field), object);
+ Try<Nothing> parse =
+ internal::parse(reflection->AddMessage(message, field), object);
+
+ if (parse.isError()) {
+ return parse;
+ }
} else {
- parse(reflection->MutableMessage(message, field), object);
+ Try<Nothing> parse =
+ internal::parse(reflection->MutableMessage(message, field), object);
+
+ if (parse.isError()) {
+ return parse;
+ }
}
break;
default: