updated build system

This commit is contained in:
2024-10-17 10:20:07 -05:00
parent 39d644e115
commit 63ca3089da
22 changed files with 304 additions and 198 deletions

View File

@ -33,6 +33,9 @@ struct i_exception_handler {
auto operator=(const i_exception_handler &) noexcept = delete;
auto operator=(i_exception_handler &&) noexcept = delete;
virtual void handle_error(std::string_view function_name,
std::string_view msg) const = 0;
virtual void handle_exception(std::string_view function_name) const = 0;
virtual void handle_exception(std::string_view function_name,
@ -43,6 +46,11 @@ 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;
}
void handle_exception(std::string_view function_name) const override {
std::cerr << function_name << "|exception|unknown" << std::endl;
}
@ -58,12 +66,18 @@ 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::string_view function_name,
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);
void handle_exception(std::string_view function_name, const std::exception &ex);