forked from LBRYCommunity/lbry-sdk
add error handling to blobs creation
This commit is contained in:
parent
84bd4fdc3e
commit
5bbb29fd79
2 changed files with 6 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue