diff --git a/lbry/dht/blob_announcer.py b/lbry/dht/blob_announcer.py index 345bbdc9f..5d977aff4 100644 --- a/lbry/dht/blob_announcer.py +++ b/lbry/dht/blob_announcer.py @@ -24,7 +24,7 @@ class BlobAnnouncer: else: log.debug("failed to announce %s, could only find %d peers, retrying soon.", blob_hash[:8], peers) except Exception as err: - if isinstance(err, asyncio.CancelledError): + if isinstance(err, asyncio.CancelledError): # TODO: remove when updated to 3.8 raise err log.warning("error announcing %s: %s", blob_hash[:8], str(err)) diff --git a/lbry/extras/daemon/components.py b/lbry/extras/daemon/components.py index 0d0ed7e47..617504b7d 100644 --- a/lbry/extras/daemon/components.py +++ b/lbry/extras/daemon/components.py @@ -376,7 +376,7 @@ class UPnPComponent(Component): self.upnp = await UPnP.discover(loop=self.component_manager.loop) log.info("found upnp gateway: %s", self.upnp.gateway.manufacturer_string) except Exception as err: - if isinstance(err, asyncio.CancelledError): + if isinstance(err, asyncio.CancelledError): # TODO: remove when updated to 3.8 raise log.warning("upnp discovery failed: %s", err) self.upnp = None diff --git a/lbry/stream/stream_manager.py b/lbry/stream/stream_manager.py index cf3a28eb3..a3e422817 100644 --- a/lbry/stream/stream_manager.py +++ b/lbry/stream/stream_manager.py @@ -371,7 +371,7 @@ class StreamManager: except asyncio.TimeoutError: raise ResolveTimeoutError(uri) except Exception as err: - if isinstance(err, asyncio.CancelledError): + if isinstance(err, asyncio.CancelledError): # TODO: remove when updated to 3.8 raise log.exception("Unexpected error resolving stream:") raise ResolveError(f"Unexpected error resolving stream: {str(err)}") diff --git a/lbry/wallet/ledger.py b/lbry/wallet/ledger.py index a3fbdf257..9847b03e3 100644 --- a/lbry/wallet/ledger.py +++ b/lbry/wallet/ledger.py @@ -701,7 +701,9 @@ class Ledger(metaclass=LedgerRegistry): "%d change addresses (gap: %d), %d channels, %d certificates and %d claims. ", account.id, balance, total_receiving, account.receiving.gap, total_change, account.change.gap, channel_count, len(account.channel_keys), claim_count) - except: # pylint: disable=bare-except + except Exception as err: + if isinstance(err, asyncio.CancelledError): # TODO: remove when updated to 3.8 + raise log.exception( 'Failed to display wallet state, please file issue ' 'for this bug along with the traceback you see below:') @@ -724,7 +726,9 @@ class Ledger(metaclass=LedgerRegistry): claim_ids = [p.purchased_claim_id for p in purchases] try: resolved, _, _ = await self.claim_search([], claim_ids=claim_ids) - except: # pylint: disable=bare-except + except Exception as err: + if isinstance(err, asyncio.CancelledError): # TODO: remove when updated to 3.8 + raise log.exception("Resolve failed while looking up purchased claim ids:") resolved = [] lookup = {claim.claim_id: claim for claim in resolved} @@ -757,7 +761,9 @@ class Ledger(metaclass=LedgerRegistry): claim_ids = collection.claim.collection.claims.ids[offset:page_size+offset] try: resolve_results, _, _ = await self.claim_search([], claim_ids=claim_ids) - except: # pylint: disable=bare-except + except Exception as err: + if isinstance(err, asyncio.CancelledError): # TODO: remove when updated to 3.8 + raise log.exception("Resolve failed while looking up collection claim ids:") return [] claims = [] diff --git a/tests/unit/stream/test_stream_manager.py b/tests/unit/stream/test_stream_manager.py index 85bdb4569..65d35e945 100644 --- a/tests/unit/stream/test_stream_manager.py +++ b/tests/unit/stream/test_stream_manager.py @@ -320,7 +320,7 @@ class TestStreamManager(BlobExchangeTestBase): try: await self.stream_manager.download_stream_from_uri(self.uri, self.exchange_rate_manager, timeout) except Exception as err: - if isinstance(err, asyncio.CancelledError): + if isinstance(err, asyncio.CancelledError): # TODO: remove when updated to 3.8 raise error = err self.assertEqual(expected_error, type(error))