]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/.../errorator: simplify maybe_handle_error_t::handle()
authorSamuel Just <sjust@redhat.com>
Wed, 7 Feb 2024 01:19:43 +0000 (17:19 -0800)
committerMatan Breizman <mbreizma@redhat.com>
Wed, 8 May 2024 07:05:36 +0000 (10:05 +0300)
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 <sjust@redhat.com>
(cherry picked from commit 979c1916507092591469f8ea3b0a0440f2b88066)

src/crimson/common/errorator.h

index ebc5a95bb3e6eeef1b47af2371cac86f3039c862..692498b75aed81c7823c5af5e58b936865b78353 100644 (file)
@@ -354,17 +354,10 @@ public:
         // to throwing an exception by the handler.
         std::invoke(std::forward<ErrorVisitorT>(errfunc),
                     ErrorT::error_t::from_exception_ptr(std::move(ep)));
-      } else if constexpr (seastar::Future<decltype(result)>) {
-        // 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<return_t>(
-          std::invoke(std::forward<ErrorVisitorT>(errfunc),
-                      ErrorT::error_t::from_exception_ptr(std::move(ep))));
       } else {
-        result = FuturatorT::type::errorator_type::template make_ready_future<return_t>(
-          std::invoke(std::forward<ErrorVisitorT>(errfunc),
-                      ErrorT::error_t::from_exception_ptr(std::move(ep))));
+        result = FuturatorT::invoke(
+         std::forward<ErrorVisitorT>(errfunc),
+         ErrorT::error_t::from_exception_ptr(std::move(ep)));
       }
     }
   }