Subject: Re: [boost] Outcome/expected/etc/etc/etc
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2017-06-05 18:19:18
>> I always wished that ASIO made the const error_code& passed in
>> non-const, and you could set it on return from the handler. You can
>> still throw an exception of course to abort everything, but sometimes
>> you don't want to abort everything. Sometimes you just want to fail.
> What kind of errors do you want to return to Asio, and how do you
> want it to respond to them?
Right now if you throw an exception from within a handler the default
action is to throw out the thread calling ioservice.run() which ran the
This isn't ideal - usually one would prefer failure to pop out of the
initiating function instead. You can implement this manually using a
custom async_result or easier, using future-promise, but I've always
wished there was a lightweight non-allocating default propagation of
handler failure => error_code => initiating function. So a super
lightweight, non-allocating future-promise like object which can solely
transport an error_code would be the default, that way end users can do
.get() on the initiating function's return if they care, if not throw it
Anyway, I figure that ship has sailed unfortunately.
-- 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