}
if (x) {
+ exception_wrapper ew;
try {
if (LIKELY(x->getNumPriorities() == 1)) {
x->add([core_ref = CountedReference(this)]() mutable {
core->callback_(std::move(*core->result_));
}, priority);
}
+ } catch (const std::exception& e) {
+ ew = exception_wrapper(std::current_exception(), e);
} catch (...) {
+ ew = exception_wrapper(std::current_exception());
+ }
+ if (ew) {
CountedReference core_ref(this);
RequestContextScopeGuard rctx(context_);
- result_ = Try<T>(exception_wrapper(std::current_exception()));
+ result_ = Try<T>(std::move(ew));
SCOPE_EXIT { callback_ = {}; };
callback_(std::move(*result_));
}
auto f = p.getFuture();
try {
throw eggs;
+ } catch (const std::exception& e) {
+ p.setException(exception_wrapper(std::current_exception(), e));
} catch (...) {
p.setException(exception_wrapper(std::current_exception()));
}
EXPECT_FALSE(f1.isReady());
try {
throw std::runtime_error("Oops");
- } catch (...) {
- p.setException(exception_wrapper(std::current_exception()));
+ } catch (const std::exception& e) {
+ p.setException(exception_wrapper(std::current_exception(), e));
}
EXPECT_TRUE(f1.isReady());
EXPECT_TRUE(f1.hasException());