Skip to content

Commit 9b5d418

Browse files
committed
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 <[email protected]>
1 parent d2a748e commit 9b5d418

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

src/crimson/common/errorator.h

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -209,22 +209,14 @@ struct unthrowable_wrapper : error_t<unthrowable_wrapper<ErrorT, ErrorV>> {
209209

210210
class assert_failure {
211211
const char* const msg = nullptr;
212-
std::function<void()> pre_assert;
213212
public:
214-
template <std::size_t N>
215-
assert_failure(const char (&msg)[N])
213+
assert_failure(const char* msg)
216214
: msg(msg) {
217215
}
218216
assert_failure() = default;
219-
template <typename Func>
220-
assert_failure(Func&& f)
221-
: pre_assert(std::forward<Func>(f)) {}
222217

223218
no_touch_error_marker operator()(const unthrowable_wrapper& raw_error) {
224219
handle([this] (auto&& error_v) {
225-
if (pre_assert) {
226-
pre_assert();
227-
}
228220
ceph_abort_msgf("%s: %s", msg ? msg : "", error_v.message().c_str());
229221
})(raw_error);
230222
return no_touch_error_marker{};
@@ -297,26 +289,14 @@ struct stateful_error_t : error_t<stateful_error_t<ErrorT>> {
297289

298290
class assert_failure {
299291
const char* const msg = nullptr;
300-
std::function<void(const ErrorT&)> pre_assert;
301292
public:
302-
template <std::size_t N>
303-
assert_failure(const char (&msg)[N])
293+
assert_failure(const char* msg)
304294
: msg(msg) {
305295
}
306296
assert_failure() = default;
307-
template <typename Func>
308-
assert_failure(Func&& f)
309-
: pre_assert(std::forward<Func>(f)) {}
310297

311298
no_touch_error_marker operator()(stateful_error_t<ErrorT>&& raw_error) {
312299
handle([this] (auto&& error_v) {
313-
if (pre_assert) {
314-
try {
315-
std::rethrow_exception(e.ep);
316-
} catch (const ErrorT& err) {
317-
pre_assert(err);
318-
}
319-
}
320300
ceph_abort_msgf("%s: %s", msg ? msg : "", error_v.message().c_str());
321301
})(std::move(raw_error));
322302
return no_touch_error_marker{};

0 commit comments

Comments
 (0)