updated build system
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
@ -25,6 +25,12 @@
|
||||
#include "utils/config.hpp"
|
||||
|
||||
namespace repertory::utils::error {
|
||||
[[nodiscard]] auto
|
||||
create_error_message(std::vector<std::string_view> items) -> std::string;
|
||||
|
||||
[[nodiscard]] auto
|
||||
create_exception(std::vector<std::string_view> items) -> std::runtime_error;
|
||||
|
||||
struct i_exception_handler {
|
||||
virtual ~i_exception_handler() {}
|
||||
|
||||
@ -48,17 +54,30 @@ protected:
|
||||
struct iostream_exception_handler final : i_exception_handler {
|
||||
void handle_error(std::string_view function_name,
|
||||
std::string_view msg) const override {
|
||||
std::cerr << function_name << '|' << msg << std::endl;
|
||||
std::cerr << create_error_message({
|
||||
function_name,
|
||||
msg,
|
||||
})
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
void handle_exception(std::string_view function_name) const override {
|
||||
std::cerr << function_name << "|exception|unknown" << std::endl;
|
||||
std::cerr << create_error_message({
|
||||
function_name,
|
||||
"exception",
|
||||
"unknown",
|
||||
})
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
void handle_exception(std::string_view function_name,
|
||||
const std::exception &ex) const override {
|
||||
std::cerr << function_name << "|exception|"
|
||||
<< (ex.what() == nullptr ? "unknown" : ex.what()) << std::endl;
|
||||
std::cerr << create_error_message({
|
||||
function_name,
|
||||
"exception",
|
||||
(ex.what() == nullptr ? "unknown" : ex.what()),
|
||||
})
|
||||
<< std::endl;
|
||||
}
|
||||
};
|
||||
inline const iostream_exception_handler default_exception_handler{};
|
||||
@ -66,15 +85,12 @@ inline const iostream_exception_handler default_exception_handler{};
|
||||
extern std::atomic<const i_exception_handler *> exception_handler;
|
||||
|
||||
#if defined(PROJECT_ENABLE_TESTING)
|
||||
[[nodiscard]] inline auto get_exception_handler()
|
||||
-> const i_exception_handler * {
|
||||
[[nodiscard]] inline auto
|
||||
get_exception_handler() -> const i_exception_handler * {
|
||||
return exception_handler;
|
||||
}
|
||||
#endif // defined(PROJECT_ENABLE_TESTING)
|
||||
|
||||
[[nodiscard]] auto create_error_message(std::vector<std::string_view> items)
|
||||
-> std::string;
|
||||
|
||||
void handle_error(std::string_view function_name, std::string_view msg);
|
||||
|
||||
void handle_exception(std::string_view function_name);
|
||||
|
Reference in New Issue
Block a user