|
Boost : |
Subject: Re: [boost] [outcome] Ternary logic -- need an example
From: Peter Dimov (lists_at_[hidden])
Date: 2017-05-20 14:28:03
Vinnie Falco wrote:
> However, the [HTTP] status code is part of the message and therefore
> should be part of the container. I do not think it should be treated as
> metadata, nor represented using error_code.
Consider this high-level function
result<vector<char>> get( string const& url );
used like this
auto r = get( "https://example.com/data.zip" );
This function can fail in many different ways, starting from the URL parser
(invalid URL), passing through the possibility of an invalid/unrecognized
URL scheme, a host that cannot be resolved, a TCP address that can't be
connected to, and finally, a 404 HTTP error code.
All these things should come back as std::error_code. There's no HTTP
message here on this layer to contain the status.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk