> On Sept. 28, 2015, 9:11 a.m., Jan Schlicht wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp, line 762
> > <https://reviews.apache.org/r/38342/diff/4/?file=1085227#file1085227line762>
> >
> >     Because this code has been changed from a constructor to a function, we 
> > can do better than calling `ABORT` here. We can change the function 
> > signature to return a `Try<Object>` and call `Error` here instead of 
> > `ABORT`. For example see the `write` function in line 55.
> >     
> >     The function signature would change to
> >     `inline Try<Object> protobuf(const google::protobuf::Message& message)`
> 
> Klaus Ma wrote:
>     Got your point :).
>     Just one concern on how to use it? We did not handle its result if failed 
> in `src`; personally, this's a kind of code practice to avoid undefined 
> protobuf field type. Anyway, I'll update accordingly if necessary.
> 
> Jan Schlicht wrote:
>     Well, unfortunately this change means that the code that is using this 
> function has to be changed to handle the error cases. This means checking if 
> the `Try<>` contains a value or an error and react accordingly.
> 
> Klaus Ma wrote:
>     Did you check the code diff of #38335? In #38335, any suggestion on the 
> function that return void; those function did not expect json parsing will 
> fail. Personally, it's a bit overkill to re-implement them for json paring 
> error handling which are not expect failed. 
>     
>     @alex-mesos, @mcypark, what's your suggestion?

My suggestion here is to leave out the `default:` case since all alternatives 
are being handled. This was discussed in 
[MESOS-26664](https://issues.apache.org/jira/browse/MESOS-2664), and here is an 
[example](https://github.com/apache/mesos/blob/7f352ef886f3116e4bef23b235d87b3182354908/src/common/http.cpp#L53).


- Michael


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/38342/#review100794
-----------------------------------------------------------


On Oct. 4, 2015, 11:29 a.m., Klaus Ma wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/38342/
> -----------------------------------------------------------
> 
> (Updated Oct. 4, 2015, 11:29 a.m.)
> 
> 
> Review request for mesos, Alexander Rukletsov, Michael Park, and Jan Schlicht.
> 
> 
> Bugs: MESOS-3405
>     https://issues.apache.org/jira/browse/MESOS-3405
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Currently, `stout/protobuf.hpp` provides a `JSON::Protobuf` utility which 
> converts a `google::protobuf::Message` into a `JSON::Object`.
> We should add the support for `google::protobuf::RepeatedPtrField<T>` by 
> introducing overloaded functions.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp 2285ce9 
>   3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.cpp 68328a2 
>   3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.pb.h 8ebb798 
>   3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.pb.cc 34eb6d0 
>   3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.proto 920f5c9 
> 
> Diff: https://reviews.apache.org/r/38342/diff/
> 
> 
> Testing
> -------
> 
> cd 3rdparty/libprocess/3rdparty/stout
> ./boostrap
> ./configure
> make
> 
> 
> Thanks,
> 
> Klaus Ma
> 
>

Reply via email to