From: Hannes Roth <hannesr@fb.com>
Date: Thu, 12 Feb 2015 18:27:33 +0000 (-0800)
Subject: (Wangle) Catch all exceptions in `then() -> Future`
X-Git-Tag: v0.27.0~49
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3f653ebe55bdce6745e99a3df91489a6fcaea5a0;p=folly.git

(Wangle) Catch all exceptions in `then() -> Future`

Summary: Saw this while debugging some stuff. Just an oversight, right?

Test Plan: Ran all the tests.

Reviewed By: hans@fb.com

Subscribers: folly-diffs@, jsedgwick, yfeldblum

FB internal diff: D1843016

Signature: t1:1843016:1423704557:d9fdb4b879ab4fcfda54a5fcb16a639df15872b5
---

diff --git a/folly/futures/Future-inl.h b/folly/futures/Future-inl.h
index a6f35c26..77ff9fa9 100644
--- a/folly/futures/Future-inl.h
+++ b/folly/futures/Future-inl.h
@@ -192,6 +192,8 @@ Future<T>::thenImplementation(F func, detail::argResult<isTry, F, Args...>) {
             p->fulfilTry(std::move(b));
           });
         } catch (const std::exception& e) {
+          p->setException(exception_wrapper(std::current_exception(), e));
+        } catch (...) {
           p->setException(exception_wrapper(std::current_exception()));
         }
       }