refactor
This commit is contained in:
@ -172,14 +172,15 @@ auto base_provider::create_directory(const std::string &api_path,
|
|||||||
"failed to create directory");
|
"failed to create directory");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
meta[META_DIRECTORY] = utils::string::from_bool(true);
|
||||||
|
return set_item_meta(api_path, meta);
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
utils::error::raise_api_path_error(function_name, api_path, e,
|
utils::error::raise_api_path_error(function_name, api_path, e,
|
||||||
"failed to create directory");
|
"failed to create directory");
|
||||||
return api_error::error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
meta[META_DIRECTORY] = utils::string::from_bool(true);
|
return api_error::error;
|
||||||
return set_item_meta(api_path, meta);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto base_provider::create_file(const std::string &api_path, api_meta_map &meta)
|
auto base_provider::create_file(const std::string &api_path, api_meta_map &meta)
|
||||||
@ -783,17 +784,17 @@ auto base_provider::upload_file(const std::string &api_path,
|
|||||||
stop_type &stop_requested) -> api_error {
|
stop_type &stop_requested) -> api_error {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
|
const auto notify_end = [&api_path,
|
||||||
|
&source_path](api_error error) -> api_error {
|
||||||
|
event_system::instance().raise<provider_upload_end>(api_path, source_path,
|
||||||
|
error);
|
||||||
|
return error;
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
event_system::instance().raise<provider_upload_begin>(api_path,
|
event_system::instance().raise<provider_upload_begin>(api_path,
|
||||||
source_path);
|
source_path);
|
||||||
|
|
||||||
const auto notify_end = [&api_path,
|
|
||||||
&source_path](api_error error) -> api_error {
|
|
||||||
event_system::instance().raise<provider_upload_end>(api_path, source_path,
|
|
||||||
error);
|
|
||||||
return error;
|
|
||||||
};
|
|
||||||
|
|
||||||
return notify_end(upload_file_impl(api_path, source_path, stop_requested));
|
return notify_end(upload_file_impl(api_path, source_path, stop_requested));
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
utils::error::raise_error(function_name, e, "exception occurred");
|
utils::error::raise_error(function_name, e, "exception occurred");
|
||||||
|
Reference in New Issue
Block a user