From: Samuel Just Date: Wed, 7 Feb 2024 01:19:43 +0000 (-0800) Subject: crimson/.../errorator: simplify maybe_handle_error_t::handle() X-Git-Tag: testing/wip-pdonnell-testing-20240517.203521-squid-debug~39^2~8 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=4c9a621c82a6e65bd189562bd2e3a6251a23cf4f;p=ceph-ci.git crimson/.../errorator: simplify maybe_handle_error_t::handle() Using FuturatorT::invoke covers both of the last two cases and also correctly deals with handlers that return interrupible futures. Signed-off-by: Samuel Just (cherry picked from commit 979c1916507092591469f8ea3b0a0440f2b88066) --- diff --git a/src/crimson/common/errorator.h b/src/crimson/common/errorator.h index ebc5a95bb3e..692498b75ae 100644 --- a/src/crimson/common/errorator.h +++ b/src/crimson/common/errorator.h @@ -354,17 +354,10 @@ public: // to throwing an exception by the handler. std::invoke(std::forward(errfunc), ErrorT::error_t::from_exception_ptr(std::move(ep))); - } else if constexpr (seastar::Future) { - // result is seastar::future but return_t is e.g. int. If so, - // the else clause cannot be used as seastar::future lacks - // errorator_type member. - result = seastar::make_ready_future( - std::invoke(std::forward(errfunc), - ErrorT::error_t::from_exception_ptr(std::move(ep)))); } else { - result = FuturatorT::type::errorator_type::template make_ready_future( - std::invoke(std::forward(errfunc), - ErrorT::error_t::from_exception_ptr(std::move(ep)))); + result = FuturatorT::invoke( + std::forward(errfunc), + ErrorT::error_t::from_exception_ptr(std::move(ep))); } } }