This commit is contained in:
2025-01-02 07:57:07 -06:00
parent 4526a9d860
commit f3093c27cd

View File

@ -140,6 +140,7 @@ auto base_provider::create_directory(const std::string &api_path,
api_meta_map &meta) -> api_error {
REPERTORY_USES_FUNCTION_NAME();
try {
bool exists{};
auto res = is_directory(api_path, exists);
if (res != api_error::success) {
@ -165,7 +166,6 @@ auto base_provider::create_directory(const std::string &api_path,
return api_error::item_exists;
}
try {
res = create_directory_impl(api_path, meta);
if (res != api_error::success) {
utils::error::raise_api_path_error(function_name, api_path, res,
@ -186,6 +186,7 @@ auto base_provider::create_file(const std::string &api_path, api_meta_map &meta)
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
try {
bool exists{};
auto res = is_directory(api_path, exists);
if (res != api_error::success && res != api_error::item_not_found) {
@ -209,7 +210,6 @@ auto base_provider::create_file(const std::string &api_path, api_meta_map &meta)
return api_error::item_exists;
}
try {
res = create_file_extra(api_path, meta);
if (res != api_error::success) {
utils::error::raise_api_path_error(function_name, api_path, res,
@ -260,6 +260,7 @@ auto base_provider::get_directory_items(const std::string &api_path,
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
try {
bool exists{};
auto res = is_directory(api_path, exists);
if (res != api_error::success) {
@ -269,7 +270,6 @@ auto base_provider::get_directory_items(const std::string &api_path,
return api_error::directory_not_found;
}
try {
res = get_directory_items_impl(api_path, list);
if (res != api_error::success) {
return res;
@ -783,7 +783,9 @@ auto base_provider::upload_file(const std::string &api_path,
stop_type &stop_requested) -> api_error {
REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<provider_upload_begin>(api_path, source_path);
try {
event_system::instance().raise<provider_upload_begin>(api_path,
source_path);
const auto notify_end = [&api_path,
&source_path](api_error error) -> api_error {
@ -792,7 +794,6 @@ auto base_provider::upload_file(const std::string &api_path,
return error;
};
try {
return notify_end(upload_file_impl(api_path, source_path, stop_requested));
} catch (const std::exception &e) {
utils::error::raise_error(function_name, e, "exception occurred");