Use simple exception_wrapper ctor in the Promise::setException test
[folly.git] / folly / futures / test / PromiseTest.cpp
index 224fc73fcdc60b76333bafaf6ba9e0f96edd4c48..3f41c0721587c7769bdf2eb2a526a8d7cbd3de65 100644 (file)
@@ -95,13 +95,13 @@ TEST(Promise, setException) {
   {
     Promise<Unit> p;
     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()));
-    }
+    p.setException(std::make_exception_ptr(eggs));
+    EXPECT_THROW(f.value(), eggs_t);
+  }
+  {
+    Promise<Unit> p;
+    auto f = p.getFuture();
+    p.setException(exception_wrapper(eggs));
     EXPECT_THROW(f.value(), eggs_t);
   }
 }