diff --git a/thrift/handler.cc b/thrift/handler.cc index fa9ce8ae2e..6d20a544cf 100644 --- a/thrift/handler.cc +++ b/thrift/handler.cc @@ -65,6 +65,18 @@ void complete(future& fut, } } +template +void complete(future>>& fut, + const tcxx::function& cob, + const tcxx::function& exn_cob) { + try { + cob(*std::get<0>(fut.get())); + } catch (...) { + delayed_exception_wrapper dew(std::current_exception()); + exn_cob(&dew); + } +} + class CassandraAsyncHandler : public CassandraCobSvIf { distributed& _db; keyspace* _ks = nullptr; // FIXME: reference counting for in-use detection?