Let Future::then call callbacks outside of the catch handler
Summary:
[Folly] Let `Future::then` call callbacks outside of the catch handler.
And `Future::onError`.
This makes the behavior of calls to `Future` callbacks with respect to currently-handled ("active") exceptions consistent - there will not be an active exception by the time the `Future` callback is called. (Unless `Future::then` or `Future::onError`, etc., is itself called with an active exception. Or unless the `Promise` is fulfilled, outside of the `Future` implementation code, with an active exception.)
This will affect any code which tries to call `std::current_exception()` or `throw;` from within a `Future` callback, such as an `onError` handler. That code will crash. (It was incorrect anyway, and relied on misusing Folly Futures.)
Reviewed By: ericniebler
Differential Revision:
D4372173
fbshipit-source-id:
600b22e4db63c98358de29a6abcee807fbc53b0f