new_build_system (#18)
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
Reviewed-on: #18
This commit is contained in:
@ -42,11 +42,33 @@ protected:
|
||||
i_exception_handler() = default;
|
||||
};
|
||||
|
||||
struct iostream_exception_handler final : i_exception_handler {
|
||||
void handle_exception(std::string_view function_name) const override {
|
||||
std::cerr << 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;
|
||||
}
|
||||
};
|
||||
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 * {
|
||||
return exception_handler;
|
||||
}
|
||||
#endif // defined(PROJECT_ENABLE_TESTING)
|
||||
|
||||
void handle_exception(std::string_view function_name);
|
||||
|
||||
void handle_exception(std::string_view function_name, const std::exception &ex);
|
||||
|
||||
void set_exception_handler(i_exception_handler *handler);
|
||||
void set_exception_handler(const i_exception_handler *handler);
|
||||
} // namespace repertory::utils::error
|
||||
|
||||
#endif // REPERTORY_INCLUDE_UTILS_ERROR_HPP_
|
||||
|
Reference in New Issue
Block a user