Summary: fixed then() exceptions propagation and added unit-test
Reviewed By: @fugalh
Differential Revision:
D2159075
template <class T>
Future<void> Future<T>::then() {
- return then([] (Try<T>&& t) {});
+ return then([] () {});
}
// onError where the callback returns T
});
EXPECT_EQ(future.value(), 23);
}
+
+TEST(Future, voidThenShouldPropagateExceptions) {
+ EXPECT_FALSE(makeFuture(42).then().hasException());
+ EXPECT_TRUE(makeFuture<int>(std::runtime_error("err"))
+ .then().hasException());
+}