can also be protocolerror

This commit is contained in:
Victor Shyba 2019-09-01 00:02:07 -03:00
parent 379144bcfe
commit 5018fe90de
2 changed files with 4 additions and 5 deletions

View file

@ -176,4 +176,4 @@ class BasicTransactionTests(IntegrationTestCase):
self.assertEqual(21, len((await self.ledger.get_local_status_and_history(address))[1]))
self.assertEqual(0, len(self.ledger._known_addresses_out_of_sync))
# should be another test, but it would be too much to setup just for that and it affects sync
self.assertIsNone(await self.ledger.network.get_transaction('1'*64))
self.assertIsNone(await self.ledger.network.retriable_call(self.ledger.network.get_transaction, '1'*64))

View file

@ -4,7 +4,7 @@ from operator import itemgetter
from typing import Dict, Optional, Tuple
from time import perf_counter
from torba.rpc import RPCSession as BaseClientSession, Connector, RPCError
from torba.rpc import RPCSession as BaseClientSession, Connector, RPCError, ProtocolError
from torba import __version__
from torba.stream import StreamController
@ -71,10 +71,9 @@ class ClientSession(BaseClientSession):
)
log.debug("got reply for %s from %s:%i", method, *self.server)
return reply
except RPCError as e:
if str(e).find('.*no such .*transaction.*') and args:
except (RPCError, ProtocolError) as e:
if str(e).find('.*no such .*transaction.*'):
# shouldnt the server return none instead?
log.warning("Requested transaction missing from server: %s", args[0])
return None
log.warning("Wallet server (%s:%i) returned an error. Code: %s Message: %s",
*self.server, *e.args)