]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/ertr: assert_all informs about error being handled that way
authorMatan Breizman <mbreizma@redhat.com>
Mon, 21 Apr 2025 14:13:31 +0000 (14:13 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Tue, 22 Apr 2025 15:11:58 +0000 (15:11 +0000)
Signed-off-by: Matan Breizman <mbreizma@redhat.com>
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/common/errorator.h

index aac30a7c0a92f9062b6a1258c4190beb6a839f20..e7c1684e5becb5471a154a0378ee653b3878a255 100644 (file)
@@ -964,7 +964,6 @@ public:
     return std::move(fut);
   }
 
-  // assert_all{ "TODO" };
   class assert_all {
     const char* const msg = nullptr;
   public:
@@ -975,14 +974,14 @@ public:
     assert_all() = default;
 
     template <class ErrorT, EnableIf<ErrorT>...>
-    no_touch_error_marker operator()(ErrorT&&) {
-      static_assert(contains_once_v<std::decay_t<ErrorT>>,
+    no_touch_error_marker operator()(ErrorT&& raw_error) {
+      using decayed_t = std::decay_t<ErrorT>;
+      static_assert(contains_once_v<decayed_t>,
                     "discarding disallowed ErrorT");
-      if (msg) {
-        ceph_abort_msg(msg);
-      } else {
-        ceph_abort();
-      }
+      auto&& handler = decayed_t::error_t::handle([this] (auto&& error_v) {
+        ceph_abort_msgf("%s: %s", msg ? msg : "", error_v.message().c_str());
+      });
+      std::invoke(std::move(handler), std::forward<ErrorT>(raw_error));
       return no_touch_error_marker{};
     }
   };
@@ -1346,15 +1345,15 @@ namespace ct_error {
       : pre_assert(std::move(f)) {}
 
     template <class ErrorT>
-    no_touch_error_marker operator()(ErrorT&&) {
+    no_touch_error_marker operator()(ErrorT&& raw_error) {
       if (pre_assert) {
         pre_assert();
       }
-      if (msg) {
-        ceph_abort_msg(msg);
-      } else {
-        ceph_abort();
-      }
+      using decayed_t = std::decay_t<ErrorT>;
+      auto&& handler = decayed_t::error_t::handle([this] (auto&& error_v) {
+        ceph_abort_msgf("%s: %s", msg ? msg : "", error_v.message().c_str());
+      });
+      std::invoke(std::move(handler), std::forward<ErrorT>(raw_error));
       return no_touch_error_marker{};
     }
   };