Browse code

Ensure to catch and display server errors for cmd cp,mv,modify errors

Florent Viard authored on 2020/04/14 08:09:09
Showing 1 changed files
... ...
@@ -906,12 +906,15 @@ def subcmd_cp_mv(args, process_fce, action_str, message):
906 906
             if Config().acl_public:
907 907
                 info(u"Public URL is: %s" % dst_uri.public_url())
908 908
             scoreboard.success()
909
-        except S3Error as e:
910
-            if e.code == "NoSuchKey":
909
+        except (S3Error, S3UploadError) as exc:
910
+            if isinstance(exc, S3Error) and exc.code == "NoSuchKey":
911 911
                 scoreboard.notfound()
912 912
                 warning(u"Key not found %s" % item['object_uri_str'])
913 913
             else:
914 914
                 scoreboard.failed()
915
+                error(u"Copy failed for: '%s' (%s)", item['object_uri_str'],
916
+                      exc)
917
+
915 918
             if cfg.stop_on_error:
916 919
                 break
917 920
     return scoreboard.rc()
... ...
@@ -1136,7 +1139,7 @@ def cmd_sync_remote2remote(args):
1136 1136
                        (src_uri, dst_uri, seq_label))
1137 1137
                 total_nb_files += 1
1138 1138
                 total_size += item.get(u'size', 0)
1139
-            except S3Error as exc:
1139
+            except (S3Error, S3UploadError) as exc:
1140 1140
                 ret = EX_PARTIAL
1141 1141
                 error(u"File '%s' could not be copied: %s", src_uri, exc)
1142 1142
                 if cfg.stop_on_error: