Make it possible to continue with a continuable from failure handlers

This commit is contained in:
Denis Blank 2018-11-30 02:10:05 +01:00
parent 4d58e3bded
commit 7352cbf8a9
2 changed files with 31 additions and 0 deletions

View File

@ -363,6 +363,12 @@ auto exception_invoker_of(traits::identity<result<Args...>> id) noexcept {
return invoker_of(id);
}
template <typename Data, typename Annotation>
auto exception_invoker_of(
traits::identity<continuable_base<Data, Annotation>> id) {
return invoker_of(id);
}
#undef CONTINUABLE_BLOCK_TRY_BEGIN
#undef CONTINUABLE_BLOCK_TRY_END
} // namespace decoration

View File

@ -131,6 +131,31 @@ TYPED_TEST(single_dimension_tests, multipath_exception_is_cancelable) {
}));
}
TYPED_TEST(single_dimension_tests, multipath_exception_is_continuable) {
ASSERT_ASYNC_RESULT(
this->supply_exception(supply_test_exception(), identity<>{})
.fail([&](exception_t) {
//
return this->supply();
}));
ASSERT_ASYNC_RESULT(
this->supply_exception(supply_test_exception(), identity<int>{})
.fail([&](exception_t) {
//
return this->supply(CANARY);
}),
CANARY);
ASSERT_ASYNC_RESULT(
this->supply_exception(supply_test_exception(), identity<int, int, int>{})
.fail([&](exception_t) {
//
return this->supply(1, CANARY, 2);
}),
1, CANARY, 2);
}
TYPED_TEST(single_dimension_tests, multipath_exception_is_autocanceled) {
bool caught = false;
ASSERT_ASYNC_INCOMPLETION(