Browse code

handle S3DownloadError better

Rather than backtracing, report the error and continue.

Matt Domsch authored on 2014/04/20 09:23:36
Showing 1 changed files
... ...
@@ -499,6 +499,12 @@ def cmd_object_get(args):
499 499
                 continue
500 500
         try:
501 501
             response = s3.object_get(uri, dst_stream, start_position = start_position, extra_label = seq_label)
502
+        except S3DownloadError, e:
503
+            error(u"%s: Skipping that file.  This is usually a transient error, please try again later." % e)
504
+            if not file_exists: # Delete, only if file didn't exist before!
505
+                debug(u"object_get failed for '%s', deleting..." % (destination,))
506
+                os.unlink(destination)
507
+            continue
502 508
         except S3Error, e:
503 509
             if not file_exists: # Delete, only if file didn't exist before!
504 510
                 debug(u"object_get failed for '%s', deleting..." % (destination,))
... ...
@@ -998,6 +1004,10 @@ def cmd_sync_remote2local(args):
998 998
                         continue
999 999
                     else:
1000 1000
                         raise
1001
+                except S3DownloadError, e:
1002
+                    error(u"%s: Skipping that file.  This is usually a transient error, please try again later." % e)
1003
+                    os.unlink(chkptfname)
1004
+                    continue
1001 1005
                 except S3Error, e:
1002 1006
                     warning(u"Remote file %s S3Error: %s" % (e.resource, e))
1003 1007
                     continue
... ...
@@ -1070,7 +1080,7 @@ def cmd_sync_remote2local(args):
1070 1070
                     os.remove(chkptfname)
1071 1071
                 except: pass
1072 1072
             except S3DownloadError, e:
1073
-                error(u"%s: download failed too many times. Skipping that file." % file)
1073
+                error(u"%s: download failed too many times. Skipping that file.  This is usually a transient error, please try again later." % file)
1074 1074
                 continue
1075 1075
             speed_fmt = formatSize(response["speed"], human_readable = True, floating_point = True)
1076 1076
             if not Config().progress_meter: