mirror of
https://github.com/Naios/continuable.git
synced 2026-01-01 03:12:12 +08:00
Make it possible to continue with a continuable from failure handlers
This commit is contained in:
parent
4d58e3bded
commit
7352cbf8a9
@ -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
|
||||
|
||||
@ -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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user