You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code works, and prints both "Recover on test called" and "Recover on package called"
// Make a ready resolved futureauto test = stlab::make_ready_future(stlab::immediate_executor);
// Create a future that we'll resolve later.auto package = stlab::package<void()>(stlab::immediate_executor, []() {});
// Chain this to-be-resolved future after test.
test.then([package]() { return package.second; })
// Chain something to catch resolves/rejections
.recover([](stlab::future<void> f) {
std::cout << "Recover on test called" << std::endl;
})
.detach();
// Also stay informed of the package:
package.second.recover([](stlab::future<void> f) {
std::cout << "Recover on package called" << std::endl;
}).detach();
// Now resolve the chained future.
package.first();
However, if we have the inner package fail, it will only print "Recover on package called":
// Make a ready resolved futureauto test = stlab::make_ready_future(stlab::immediate_executor);
// Create a future that we'll resolve later.auto package = stlab::package<void()>(stlab::immediate_executor, []() {throwstd::runtime_error("Oops");});
// Chain this to-be-resolved future after test.
test.then([package]() { return package.second; })
// Chain something to catch resolves/rejections
.recover([](stlab::future<void> f) {
std::cout << "Recover on test called" << std::endl;
})
.detach();
// Also stay informed of the package:
package.second.recover([](stlab::future<void> f) {
std::cout << "Recover on package called" << std::endl;
}).detach();
// Now resolve the chained future.
package.first();
I'm running a clone from the master branch that is up to date as of today...
The text was updated successfully, but these errors were encountered:
The following code works, and prints both "Recover on test called" and "Recover on package called"
However, if we have the inner package fail, it will only print "Recover on package called":
I'm running a clone from the master branch that is up to date as of today...
The text was updated successfully, but these errors were encountered: