Update error that daemon catches for malformed metadata
Now jsonschema.ValidationError instead of AssertionError
This commit is contained in:
parent
9cf1d6b710
commit
0dd9aa0d67
2 changed files with 5 additions and 3 deletions
|
@ -13,6 +13,7 @@ from twisted.python.failure import Failure
|
|||
from twisted.enterprise import adbapi
|
||||
from collections import defaultdict, deque
|
||||
from zope.interface import implements
|
||||
from jsonschema import ValidationError
|
||||
from decimal import Decimal
|
||||
|
||||
from lbryum import SimpleConfig, Network
|
||||
|
@ -338,7 +339,7 @@ class Wallet(object):
|
|||
|
||||
try:
|
||||
metadata = Metadata(json.loads(result['value']))
|
||||
except (ValueError, TypeError):
|
||||
except ValidationError:
|
||||
return Failure(InvalidStreamInfoError(name))
|
||||
|
||||
txid = result['txid']
|
||||
|
@ -421,7 +422,7 @@ class Wallet(object):
|
|||
meta_ver = metadata.version
|
||||
sd_hash = metadata['sources']['lbry_sd_hash']
|
||||
d = self._save_name_metadata(name, txid, sd_hash)
|
||||
except AssertionError:
|
||||
except ValidationError:
|
||||
metadata = claim['value']
|
||||
meta_ver = "Non-compliant"
|
||||
d = defer.succeed(None)
|
||||
|
|
|
@ -23,6 +23,7 @@ from twisted.internet.task import LoopingCall
|
|||
from txjsonrpc import jsonrpclib
|
||||
from txjsonrpc.web import jsonrpc
|
||||
from txjsonrpc.web.jsonrpc import Handler
|
||||
from jsonschema import ValidationError
|
||||
|
||||
from lbrynet import __version__ as lbrynet_version
|
||||
from lbryum.version import LBRYUM_VERSION as lbryum_version
|
||||
|
@ -2009,7 +2010,7 @@ class Daemon(jsonrpc.JSONRPC):
|
|||
metadata = Metadata(p['metadata'])
|
||||
make_lbry_file = False
|
||||
sd_hash = metadata['sources']['lbry_sd_hash']
|
||||
except AssertionError:
|
||||
except ValidationError:
|
||||
make_lbry_file = True
|
||||
sd_hash = None
|
||||
metadata = p['metadata']
|
||||
|
|
Loading…
Reference in a new issue