enable v2 errors
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit

This commit is contained in:
Scott E. Graves 2025-04-15 14:27:58 -05:00
parent a8723a6b02
commit 0bfe1e1ccd
3 changed files with 39 additions and 9 deletions

View File

@ -21,6 +21,7 @@ PROJECT_PUBLIC_KEY=${DEVELOPER_PUBLIC_KEY}
PROJECT_FLUTTER_BASE_HREF="/ui/" PROJECT_FLUTTER_BASE_HREF="/ui/"
PROJECT_ENABLE_V2_ERRORS=ON
PROJECT_ENABLE_WIN32_LONG_PATH_NAMES=OFF PROJECT_ENABLE_WIN32_LONG_PATH_NAMES=OFF
PROJECT_ENABLE_BACKWARD_CPP=OFF PROJECT_ENABLE_BACKWARD_CPP=OFF

View File

@ -22,6 +22,7 @@
#include "utils/error_utils.hpp" #include "utils/error_utils.hpp"
#include "events/event_system.hpp" #include "events/event_system.hpp"
#include "events/types/debug_log.hpp"
#include "events/types/repertory_exception.hpp" #include "events/types/repertory_exception.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
#include "utils/error.hpp" #include "utils/error.hpp"
@ -29,6 +30,12 @@
namespace { namespace {
struct repertory_exception_handler final struct repertory_exception_handler final
: repertory::utils::error::i_exception_handler { : repertory::utils::error::i_exception_handler {
void handle_debug(std::string_view function_name,
std::string_view msg) const override {
repertory::event_system::instance().raise<repertory::debug_log>(
function_name, msg);
}
void handle_error(std::string_view function_name, void handle_error(std::string_view function_name,
std::string_view msg) const override { std::string_view msg) const override {
repertory::utils::error::raise_error(function_name, msg); repertory::utils::error::raise_error(function_name, msg);
@ -42,6 +49,24 @@ struct repertory_exception_handler final
const std::exception &ex) const override { const std::exception &ex) const override {
repertory::utils::error::raise_error(function_name, ex); repertory::utils::error::raise_error(function_name, ex);
} }
void handle_info(std::string_view function_name,
std::string_view msg) const override {
repertory::event_system::instance().raise<repertory::debug_log>(
function_name, msg);
}
void handle_trace(std::string_view function_name,
std::string_view msg) const override {
repertory::event_system::instance().raise<repertory::debug_log>(
function_name, msg);
}
void handle_warn(std::string_view function_name,
std::string_view msg) const override {
repertory::event_system::instance().raise<repertory::debug_log>(
function_name, msg);
}
}; };
const auto repertory_handler{ const auto repertory_handler{

View File

@ -86,11 +86,15 @@ auto traverse_directory(
struct dirent *de{nullptr}; struct dirent *de{nullptr};
while (res && (de = readdir(root)) && !is_stop_requested()) { while (res && (de = readdir(root)) && !is_stop_requested()) {
if (de->d_type == DT_DIR) { if (de->d_type == DT_DIR) {
if ((std::string_view(de->d_name) != ".") && utils::error::handle_debug(function_name,
(std::string_view(de->d_name) != "..")) { fmt::format("item|{}", de->d_name));
if ((std::string(de->d_name) == ".") ||
(std::string(de->d_name) == "..")) {
continue;
}
res = directory_action(repertory::utils::file::directory( res = directory_action(repertory::utils::file::directory(
repertory::utils::path::combine(path, {de->d_name}))); repertory::utils::path::combine(path, {de->d_name})));
}
} else { } else {
res = file_action(repertory::utils::file::file( res = file_action(repertory::utils::file::file(
repertory::utils::path::combine(path, {de->d_name}))); repertory::utils::path::combine(path, {de->d_name})));
@ -105,8 +109,8 @@ auto traverse_directory(
} // namespace } // namespace
namespace repertory::utils::file { namespace repertory::utils::file {
auto directory::copy_to(std::string_view new_path, auto directory::copy_to(std::string_view new_path, bool overwrite) const
bool overwrite) const -> bool { -> bool {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
try { try {
@ -213,7 +217,7 @@ auto directory::exists() const -> bool {
#if defined(_WIN32) #if defined(_WIN32)
return ::PathIsDirectoryA(path_.c_str()) != 0; return ::PathIsDirectoryA(path_.c_str()) != 0;
#else // !defined(_WIN32) #else // !defined(_WIN32)
struct stat64 st {}; struct stat64 st{};
return (stat64(path_.c_str(), &st) == 0 && S_ISDIR(st.st_mode)); return (stat64(path_.c_str(), &st) == 0 && S_ISDIR(st.st_mode));
#endif // defined(_WIN32) #endif // defined(_WIN32)
@ -266,8 +270,8 @@ auto directory::get_directories() const -> std::vector<fs_directory_t> {
return {}; return {};
} }
auto directory::create_file(std::string_view file_name, auto directory::create_file(std::string_view file_name, bool read_only) const
bool read_only) const -> fs_file_t { -> fs_file_t {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
try { try {