Skip to content

Commit

Permalink
Try to abort MultiPart upload on all errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mludvig committed Jan 5, 2012
1 parent 57da4c6 commit 07ed770
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions S3/MultiPart.py
Expand Up @@ -58,10 +58,10 @@ def upload_all_parts(self):
}
try:
self.upload_part(seq, offset, current_chunk_size, labels)
except S3UploadError, e:
error(u"Upload of '%s' part %d failed too many times. Aborting multipart upload." % (self.file.name, seq))
except:
error(u"Upload of '%s' part %d failed. Aborting multipart upload." % (self.file.name, seq))
self.abort_upload()
raise e
raise
seq += 1

debug("MultiPart: Upload finished: %d parts", seq - 1)
Expand Down Expand Up @@ -106,7 +106,7 @@ def abort_upload(self):
"""
debug("MultiPart: Aborting upload: %s" % self.upload_id)
request = self.s3.create_request("OBJECT_DELETE", uri = self.uri, extra = "?uploadId=%s" % (self.upload_id))
response = self.s3.send_request(request, body = body)
response = self.s3.send_request(request)
return response

# vim:et:ts=4:sts=4:ai

0 comments on commit 07ed770

Please sign in to comment.