Hi,
thanks for the clarifications!
Yes, I was aware of that, I just wrote it imprecisely. What I meant is what you wrote 😊 (i.e., that coroutine machinery arranges for correct exception propagation from the callee to the caller).
Unrelated: do you have advice on error-handling patterns? Given two "loops", one that reads data from a socket and another that writes data to a socket. Currently, I handle errors with the following pattern:
error_code ec;
something_async(…, ec);
if (!HandleError(ec, "something_async"))
return; // shared_from_this() pattern
where HandleError is defined as
bool HandleError(const error_code& ec, const char* what)
{
if (IsCanceled() || !_socket.is_open() || ec == boost::system::errc::operation_canceled)
return false;
if (!ec)
return true;
throw Failure(WeakSelf(), ec, what);
}