From 9b5d41835ffc0606a2022b5ad936e75f53ec0bad Mon Sep 17 00:00:00 2001 From: Matan Breizman Date: Mon, 21 Apr 2025 14:11:52 +0000 Subject: [PATCH] crimosn/common/errorator: cleanup assert_failure pre_assert Any usage should be replaced with a message that supports priniting the error. Signed-off-by: Matan Breizman --- src/crimson/common/errorator.h | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/src/crimson/common/errorator.h b/src/crimson/common/errorator.h index 945b03698e6f7..7d817ff7f5e30 100644 --- a/src/crimson/common/errorator.h +++ b/src/crimson/common/errorator.h @@ -209,22 +209,14 @@ struct unthrowable_wrapper : error_t> { class assert_failure { const char* const msg = nullptr; - std::function pre_assert; public: - template - assert_failure(const char (&msg)[N]) + assert_failure(const char* msg) : msg(msg) { } assert_failure() = default; - template - assert_failure(Func&& f) - : pre_assert(std::forward(f)) {} no_touch_error_marker operator()(const unthrowable_wrapper& raw_error) { handle([this] (auto&& error_v) { - if (pre_assert) { - pre_assert(); - } ceph_abort_msgf("%s: %s", msg ? msg : "", error_v.message().c_str()); })(raw_error); return no_touch_error_marker{}; @@ -297,26 +289,14 @@ struct stateful_error_t : error_t> { class assert_failure { const char* const msg = nullptr; - std::function pre_assert; public: - template - assert_failure(const char (&msg)[N]) + assert_failure(const char* msg) : msg(msg) { } assert_failure() = default; - template - assert_failure(Func&& f) - : pre_assert(std::forward(f)) {} no_touch_error_marker operator()(stateful_error_t&& raw_error) { handle([this] (auto&& error_v) { - if (pre_assert) { - try { - std::rethrow_exception(e.ep); - } catch (const ErrorT& err) { - pre_assert(err); - } - } ceph_abort_msgf("%s: %s", msg ? msg : "", error_v.message().c_str()); })(std::move(raw_error)); return no_touch_error_marker{}; -- 2.39.5