Boost logo

Boost :

Subject: Re: [boost] [review] Review of Outcome (starts Fri-19-May)
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2017-05-21 23:22:15


>> Is this sufficient, or would you prefer a different example?
>
> Thanks, that's very helpful.
>
> The use case here is similar to std::throw_with_nested, you have an
> error_code that you are overriding with another. You could extend your
> ring buffer facility to support this natively. For that, you need to
> store in the buffer entry the error code (a duplicate of
> error_code_extended's members) _and_ the unique_id of the "parent"
> error_info_extended. This would allow you to later retrieve the whole
> chain of ring buffer entries (subject to availability.) In your example,
> you'd do
>
> testret = error_code_extended(
> kerneltest_errc::filesystem_comparison_internal_failure,
> workspaces_not_identical.error() );
>
> Since workspaces_not_identical.error() is already in the ring buffer,
> you only need a 'pointer' to it in testret. There's also no need to pass
> its message() in testret's message, you could use that for other purposes.

Actually it's not in the ring buffer, it was an error code raised by the
Filesystem TS implementation. No extended info because it had nothing to
do with Outcome.

There is no way to chain extended info's because the ring buffer keeps
the extended information only. If you wanted to implement a chain, as
the Outcome FAQ mentions you can convert your error_code_extended into
an exception object and chain them via the STL's nested exception framework.

Niall

-- 
ned Productions Limited Consulting
http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk