Merge branch 'stopexceptions' into development

This commit is contained in:
Jimmy Kiselak 2016-03-12 14:08:42 -05:00
commit 6c733f84e9
2 changed files with 6 additions and 3 deletions

View file

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

View file

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