catch errors

This commit is contained in:
Jack Robison 2018-10-18 13:00:27 -04:00
parent a5d21081b9
commit 3c5fb6490d
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 8 additions and 2 deletions

View file

@ -2,6 +2,7 @@ from random import choice
import logging
from twisted.internet import defer, task
from twisted.internet.error import ConnectingCancelledError
from twisted.web._newclient import ResponseNeverReceived
import treq
from lbrynet.core.utils import DeferredDict
from lbrynet.core.Error import DownloadCanceledError
@ -132,9 +133,10 @@ class HTTPBlobDownloader:
yield self.blob_manager.blob_completed(blob, should_announce=should_announce)
self.downloaded_blob_hashes.append(blob.blob_hash)
break
except (IOError, Exception, defer.CancelledError, ConnectingCancelledError) as e:
except (IOError, Exception, defer.CancelledError, ConnectingCancelledError, ResponseNeverReceived) as e:
if isinstance(
e, (DownloadCanceledError, defer.CancelledError, ConnectingCancelledError)
e, (DownloadCanceledError, defer.CancelledError, ConnectingCancelledError,
ResponseNeverReceived)
) or 'closed file' in str(e):
# some other downloader finished first or it was simply cancelled
log.info("Mirror download cancelled: %s", blob.blob_hash)

View file

@ -94,6 +94,10 @@ class Account(BaseAccount):
try:
txid, nout = maybe_claim_id.split(':')
tx = await self.ledger.db.get_transaction(txid=txid)
if not tx:
log.warning("Claim migration failed to find a transaction for outpoint %s:%i")
results['previous-corrupted'] += 1
continue
if tx.outputs[int(nout)].script.is_claim_involved:
results['previous-success'] += 1
else: