add error handling to blobs creation

This commit is contained in:
Victor Shyba 2017-07-17 02:14:01 -03:00 committed by Jack Robison
parent 84bd4fdc3e
commit 5bbb29fd79
No known key found for this signature in database
GPG key ID: 284699E7404E3CFF
2 changed files with 6 additions and 0 deletions

View file

@ -51,13 +51,18 @@ class StreamCreator(object):
current_blob = self.current_blob
d = current_blob.close()
d.addCallback(self._blob_finished)
d.addErrback(self._error)
self.finished_deferreds.append(d)
self.current_blob = None
self._finalize()
dl = defer.DeferredList(self.finished_deferreds)
dl.addCallback(lambda _: self._finished())
dl.addErrback(self._error)
return dl
def _error(self, error):
log.error(error)
def _finalize(self):
pass

View file

@ -80,6 +80,7 @@ class CryptStreamCreator(StreamCreator):
def close_blob(blob):
d = blob.close()
d.addCallback(self._blob_finished)
d.addErrback(self._error)
self.finished_deferreds.append(d)
while len(data) > 0: