From: Sam Merat Date: Thu, 18 Jun 2015 18:42:07 +0000 (-0700) Subject: then() ropagates exceptions properly X-Git-Tag: v0.47.0~3 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=372fad515345d453e340a01b54b2ded98a6f2f40;p=folly.git then() ropagates exceptions properly Summary: fixed then() exceptions propagation and added unit-test Reviewed By: @fugalh Differential Revision: D2159075 --- diff --git a/folly/futures/Future-inl.h b/folly/futures/Future-inl.h index 0d6679d8..22816e91 100644 --- a/folly/futures/Future-inl.h +++ b/folly/futures/Future-inl.h @@ -227,7 +227,7 @@ auto Future::then(Executor* x, Arg&& arg, Args&&... args) template Future Future::then() { - return then([] (Try&& t) {}); + return then([] () {}); } // onError where the callback returns T diff --git a/folly/futures/test/ThenTest.cpp b/folly/futures/test/ThenTest.cpp index 6d330f64..3264dded 100644 --- a/folly/futures/test/ThenTest.cpp +++ b/folly/futures/test/ThenTest.cpp @@ -168,3 +168,9 @@ TEST(Then, constValue) { }); EXPECT_EQ(future.value(), 23); } + +TEST(Future, voidThenShouldPropagateExceptions) { + EXPECT_FALSE(makeFuture(42).then().hasException()); + EXPECT_TRUE(makeFuture(std::runtime_error("err")) + .then().hasException()); +}