From: Matan Breizman Date: Mon, 21 Apr 2025 14:11:47 +0000 (+0000) Subject: crimson/common/errorator: assert_failure to print error X-Git-Tag: v20.3.0~28^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=d2a748e2b730d5c74f6ed9e0a54db3fe25bcf162;p=ceph.git crimson/common/errorator: assert_failure to print error Signed-off-by: Matan Breizman --- diff --git a/src/crimson/common/errorator.h b/src/crimson/common/errorator.h index ce11c2919cb18..945b03698e6f7 100644 --- a/src/crimson/common/errorator.h +++ b/src/crimson/common/errorator.h @@ -220,15 +220,13 @@ struct unthrowable_wrapper : error_t> { assert_failure(Func&& f) : pre_assert(std::forward(f)) {} - no_touch_error_marker operator()(const unthrowable_wrapper&) { - if (pre_assert) { - pre_assert(); - } - if (msg) { - ceph_abort_msg(msg); - } else { - ceph_abort(); - } + 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{}; } }; @@ -310,19 +308,17 @@ struct stateful_error_t : error_t> { assert_failure(Func&& f) : pre_assert(std::forward(f)) {} - no_touch_error_marker operator()(stateful_error_t&& e) { - if (pre_assert) { - try { - std::rethrow_exception(e.ep); - } catch (const ErrorT& err) { - pre_assert(err); + 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); + } } - } - if (msg) { - ceph_abort_msg(msg); - } else { - ceph_abort(); - } + ceph_abort_msgf("%s: %s", msg ? msg : "", error_v.message().c_str()); + })(std::move(raw_error)); return no_touch_error_marker{}; } };