From: Matan Breizman Date: Mon, 21 Apr 2025 14:13:31 +0000 (+0000) Subject: crimson/ertr: assert_all informs about error being handled that way X-Git-Tag: v20.3.0~28^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2342382620eb7d9b52a41ca50c19206b544887b6;p=ceph.git crimson/ertr: assert_all informs about error being handled that way Signed-off-by: Matan Breizman Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/crimson/common/errorator.h b/src/crimson/common/errorator.h index aac30a7c0a9..e7c1684e5be 100644 --- a/src/crimson/common/errorator.h +++ b/src/crimson/common/errorator.h @@ -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 ...> - no_touch_error_marker operator()(ErrorT&&) { - static_assert(contains_once_v>, + no_touch_error_marker operator()(ErrorT&& raw_error) { + using decayed_t = std::decay_t; + static_assert(contains_once_v, "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(raw_error)); return no_touch_error_marker{}; } }; @@ -1346,15 +1345,15 @@ namespace ct_error { : pre_assert(std::move(f)) {} template - 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; + 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(raw_error)); return no_touch_error_marker{}; } };