From 4c9a621c82a6e65bd189562bd2e3a6251a23cf4f Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Tue, 6 Feb 2024 17:19:43 -0800 Subject: [PATCH] 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) --- src/crimson/common/errorator.h | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) 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))); } } } -- 2.39.5