mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Mahler <bmah...@apache.org>
Subject Re: Review Request 72600: Remove credential text format support.
Date Thu, 23 Jul 2020 18:40:27 GMT


> On June 19, 2020, 6:28 p.m., Benjamin Mahler wrote:
> > src/credentials/credentials.hpp
> > Line 67 (original), 65 (patched)
> > <https://reviews.apache.org/r/72600/diff/1/?file=2234791#file2234791line67>
> >
> >     Can you re-work the logic here so that errors are handled first and the error
messages from the Trys are included?
> 
> Dong Zhu wrote:
>     Hi Ben,
>     
>     Sure. I have updated the patch per your suggestion.

Oh, the errors are still not handled first.. what I mean is:

```
  Try<JSON::Object> json = JSON::parse<JSON::Object>(read.get());
  if (!json.isError()) {
    Try<Credentials> credentials = ::protobuf::parse<Credentials>(json.get());
    if (!credentials.isError()) {
      return credentials.get();
    } else {
      return Error("Failed to parse credentials: "
                   + credentials.error());
    }
  } else {
    return Error("Invalid json format: " + json.error());
  }
```

Becomes:

```
  Try<JSON::Object> json = JSON::parse<JSON::Object>(read.get());
  
  if (json.isError()) {
    return Error("Invalid json format: " + json.error());
  }
  
  Try<Credentials> credentials = ::protobuf::parse<Credentials>(*json);
  
  if (credentials.isError()) {
    return Error("Failed to parse credentials: "
                 + credentials.error());
  }
    
  return *credentials;
```

Ends up with less logical nesting and jumping needed, and so it's the way we generally try
to format the code in mesos.


- Benjamin


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


On July 8, 2020, 12:47 a.m., Dong Zhu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/72600/
> -----------------------------------------------------------
> 
> (Updated July 8, 2020, 12:47 a.m.)
> 
> 
> Review request for mesos, Benjamin Mahler and Vinod Kone.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Since text format for credential is no longer supported, remove it.
> 
> 
> Diffs
> -----
> 
>   CHANGELOG 11c5c9983b9c77b5ca4d3ff11232b4d4a66e3615 
>   src/credentials/credentials.hpp 6e9f4aabfa810a4569acdcbeb9491f928e29bb9d 
> 
> 
> Diff: https://reviews.apache.org/r/72600/diff/3/
> 
> 
> Testing
> -------
> 
> Manually tested
> make check
> 
> 
> Thanks,
> 
> Dong Zhu
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message