make publish fail when given an invalid file

otherwise a less obvious error is returned in
lbrynet_daemon.Publisher.Publisher._show_publish_error
This commit is contained in:
Jack 2016-10-17 14:25:36 -04:00
parent 733bb3bccf
commit d860c2a2b4

View file

@ -2010,11 +2010,16 @@ class Daemon(jsonrpc.JSONRPC):
metadata = Metadata(p['metadata'])
make_lbry_file = False
sd_hash = metadata['sources']['lbry_sd_hash']
log.info("Update publish for %s using existing stream", name)
except ValidationError:
make_lbry_file = True
sd_hash = None
metadata = p['metadata']
file_path = p['file_path']
if not file_path:
return defer.fail(Exception("No file given to publish"))
if not os.path.isfile(file_path):
return defer.fail(Exception("Specified file for publish doesnt exist: %s" % str(file_path)))
if not self.pending_claim_checker.running:
self.pending_claim_checker.start(30)