hide exceptions that show up in the dht and due to bad metadata in the blockchain

This commit is contained in:
Jimmy Kiselak 2016-03-12 14:08:15 -05:00
parent b4c528f6b5
commit 45f9a10bfb
2 changed files with 6 additions and 3 deletions

View file

@ -294,7 +294,7 @@ class LBRYWallet(object):
value = result['value']
try:
value_dict = json.loads(value)
except ValueError:
except (ValueError, TypeError):
return Failure(InvalidStreamInfoError(name))
known_fields = ['stream_hash', 'name', 'description', 'key_fee', 'key_fee_address', 'thumbnail',
'content_license']
@ -395,7 +395,7 @@ class LBRYWallet(object):
if 'name' in claim and str(claim['name']) == name and 'value' in claim:
try:
value_dict = json.loads(claim['value'])
except ValueError:
except (ValueError, TypeError):
return None
if 'stream_hash' in value_dict and str(value_dict['stream_hash']) == sd_hash:
if 'is controlling' in claim and claim['is controlling']:

View file

@ -99,7 +99,10 @@ class Bencode(Encoding):
"""
if len(data) == 0:
raise DecodeError, 'Cannot decode empty string'
try:
return self._decodeRecursive(data)[0]
except ValueError as e:
raise DecodeError, e.message
@staticmethod
def _decodeRecursive(data, startIndex=0):