Files
scylladb/utils/on_internal_error.cc
Nadav Har'El 33476c7b06 utils: add "fatal" version of utils::on_internal_error()
utils::on_internal_error() is a wrapper for Seastar's on_internal_error()
which does not require a logger parameter - because it always uses one
logger ("on_internal_error"). Not needing a unique logger is especially
important when using on_internal_error() in a header file, where we
can't define a logger.

Seastar also has a another similar function, on_fatal_internal_error(),
for which we forgot to implement a "utils" version (without a logger
parameter). This patch fixes that oversight.

In the next patch, we need to use on_fatal_internal_error() in a header
file, so the "utils" version will be useful. We will need the fatal
version because we will encounter an unexpected situation during server
destruction, and if we let the regular on_internal_error() just throw
an exception, we'll be left in an undefined state.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
2025-08-01 02:15:04 +03:00

26 lines
610 B
C++

/*
* Copyright (C) 2024-present ScyllaDB
*/
/*
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*/
#include <seastar/core/on_internal_error.hh>
#include <seastar/util/log.hh>
#include "on_internal_error.hh"
static seastar::logger on_internal_error_logger("on_internal_error");
namespace utils {
[[noreturn]] void on_internal_error(std::string_view reason) {
seastar::on_internal_error(on_internal_error_logger, reason);
}
[[noreturn]] void on_fatal_internal_error(std::string_view reason) noexcept {
seastar::on_fatal_internal_error(on_internal_error_logger, reason);
}
}