Given a coroutine spawn into..
void my_coroutine(asio::yield_context yield) {
system::error_code ec;
my_wrapper(yield[ec]);
if (ec) {
// something went wrong
return;
}
...
}
void my_wrapper(asio::yield_context&& yield) {
asio::async_read(..., yield); // any asio async call
if (ec) {
// something went wrong
return;
}
...
}
In the wrapper function, it's not possible to get access to ec from the passed yield context. So how can this be resolved?