Summary:
This diff allows us to use folly::exception_wrapper in ClientReceiveState. Existing use cases are still supported (crs.exception() still returns an exception_ptr no matter what), but we can now choose to set an exception without throwing first.
On the folly side, add some new functions for making an exception_ptr from an exception_wrapper.
Test Plan: Reran unit tests
Reviewed By: davejwatson@fb.com
FB internal diff:
D1307027
@override-unit-failures
explicit operator bool() const { return get(); }
+ std::exception_ptr getExceptionPtr() const {
+ try {
+ throwException();
+ } catch (...) {
+ return std::current_exception();
+ }
+ }
+
private:
std::shared_ptr<std::exception> item_;
void (*throwfn_)(std::exception*);