Boost logo

Boost :

Subject: Re: [boost] LEAF has been refactored, it now has a much simplified error handling interface
From: Sorin Fetche (sorin.fetche_at_[hidden])
Date: 2019-01-23 03:00:46


On Tue, Jan 22, 2019 at 2:34 PM Emil Dotchevski via Boost
<boost_at_[hidden]> wrote:
>
> Using try_ will now handle result<T> errors as well, see
> https://github.com/zajo/leaf/blob/feature/error_code/test/try_exception_and_result_test.cpp
> .
>
> With this, in your example instead of handle_all you can just use try_:
>
> leaf::try_(
> [i]() -> leaf::result<int> {
> LEAF_AUTO(r, f2(i));
> (void) r;
> return 0;
> },
> //handlers...

Yes, the output of the attached program shows closer to what I had in
mind, if compiled with g++ 7 or 8, release mode.

It has two problems though:
- in release mode the program crashes if I try to print
'verbose_diagnostic_info'
    <snip>
    f2(7)
    Segmentation fault (core dumped)
- in debug mode it crashes right at the beginning
     f2(0)
     leaf_test:
/mnt/d/Sorin/Work/C++/cpp-playground/tmp/include/boost/leaf/detail/teleport.hpp:195:
const std::exception* boost::leaf::error_info::exception() const:
Assertion `has_exception()' failed.
    Aborted (core dumped)

Thanks,
Sorin





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