mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Rukletsov <ruklet...@gmail.com>
Subject Re: Review Request 68945: Fused constructors of `MethodNotAllowed` into one.
Date Mon, 08 Oct 2018 14:39:45 GMT


> On Oct. 8, 2018, 10:49 a.m., Benno Evers wrote:
> > 3rdparty/libprocess/include/process/http.hpp
> > Lines 777 (patched)
> > <https://reviews.apache.org/r/68945/diff/2/?file=2095314#file2095314line784>
> >
> >     I'd probably consider using `strings::format()` here.

It is indeed a bit nicer, but I'd say the readability benefit does not outweigh the cost of
including an extra header.
```
        "405 Method Not Allowed. Expecting one of { '" +
        strings::join("', '", allowedMethods) + "' }" +
        (requestMethod.isSome()
           ? ", but received '" + requestMethod.get() + "'"
           : "") +
        ".";
```
vs.
```
        strings::format(
            "405 Method Not Allowed. Expecting one of { '%s' }%s.",
            strings::join("', '", allowedMethods),
            requestMethod.isSome()
              ? ", but received '" + requestMethod.get() + "'"
              : "");
```


- Alexander


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


On Oct. 8, 2018, 7:50 a.m., Alexander Rukletsov wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/68945/
> -----------------------------------------------------------
> 
> (Updated Oct. 8, 2018, 7:50 a.m.)
> 
> 
> Review request for mesos and Benno Evers.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> There is no good reason to provide two c-tors for `MethodNotAllowed`,
> with one taking `requestMethod` and one not. Instead, an `Option<>`
> can be used. This also removes the need for copy-paste in the c-tor
> body.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp cef511a1563a26e170ce7f4a49de12776b4512e7

> 
> 
> Diff: https://reviews.apache.org/r/68945/diff/2/
> 
> 
> Testing
> -------
> 
> `make check` on various linux distros
> 
> 
> Thanks,
> 
> Alexander Rukletsov
> 
>


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