handle remove error
This commit is contained in:
@ -33,6 +33,7 @@
|
||||
#include "utils/file_utils.hpp"
|
||||
#include "utils/path.hpp"
|
||||
#include "utils/polling.hpp"
|
||||
#include <utils/config.hpp>
|
||||
|
||||
namespace repertory {
|
||||
encrypt_provider::encrypt_provider(app_config &config)
|
||||
@ -806,6 +807,8 @@ auto encrypt_provider::read_file_bytes(const std::string &api_path,
|
||||
}
|
||||
|
||||
void encrypt_provider::remove_deleted_files(stop_type &stop_requested) {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
db_->enumerate_api_path_list(
|
||||
[this, &stop_requested](auto &&list) {
|
||||
std::vector<i_file_db::file_info> removed_list{};
|
||||
@ -824,16 +827,22 @@ void encrypt_provider::remove_deleted_files(stop_type &stop_requested) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO handle error
|
||||
auto del_res{db_->remove_item(item.api_path)};
|
||||
if (item.directory) {
|
||||
event_system::instance().raise<directory_removed_externally>(
|
||||
item.api_path, item.source_path);
|
||||
auto res{db_->remove_item(item.api_path)};
|
||||
if (res != api_error::success) {
|
||||
utils::error::raise_api_path_error(
|
||||
function_name, item.api_path, item.source_path, res,
|
||||
fmt::format("failed to process externally removed item|dir|{}",
|
||||
utils::string::from_bool(item.directory)));
|
||||
continue;
|
||||
}
|
||||
|
||||
event_system::instance().raise<file_removed_externally>(
|
||||
item.api_path, item.source_path);
|
||||
if (item.directory) {
|
||||
event_system::instance().raise<directory_removed_externally>(
|
||||
item.api_path, item.source_path);
|
||||
} else {
|
||||
event_system::instance().raise<file_removed_externally>(
|
||||
item.api_path, item.source_path);
|
||||
}
|
||||
}
|
||||
},
|
||||
stop_requested);
|
||||
|
Reference in New Issue
Block a user