| 227 | |
| 228 | template <typename Executor, typename CompletionToken> |
| 229 | decltype(auto) async_throw_from_completion(Executor const & ex, CompletionToken&& token) |
| 230 | { |
| 231 | using signature_type = void(); |
| 232 | return asio_impl::async_initiate<CompletionToken, signature_type>( |
| 233 | [ex](auto h) |
| 234 | { |
| 235 | auto const assoc = asio_impl::get_associated_executor(h, ex); |
| 236 | asio_impl::post(ex, |
| 237 | asio_impl::bind_executor(assoc, |
| 238 | [h = std::move(h)]() |
| 239 | { throw std::logic_error("Test"); })); |
| 240 | }, |
| 241 | token); |
| 242 | } |
| 243 | |
| 244 | TEST_CASE("When a completion handler invoked as part of a composed " |
| 245 | "asynchronous operation throws that exception is captured and sent as a " |
no outgoing calls
no test coverage detected