From 53df361d232bffd9d74933eca550c01d75dba362 Mon Sep 17 00:00:00 2001 From: Job Evers-Meltzer Date: Fri, 16 Dec 2016 00:32:06 -0600 Subject: [PATCH] Log failure when attempting to get_lbry_files I had an old version of lbryum installed and so no names were coming back. But the daemon was failing silently. This at least logs the error. --- lbrynet/lbrynet_daemon/Daemon.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lbrynet/lbrynet_daemon/Daemon.py b/lbrynet/lbrynet_daemon/Daemon.py index 0749c7081..3f6047a30 100644 --- a/lbrynet/lbrynet_daemon/Daemon.py +++ b/lbrynet/lbrynet_daemon/Daemon.py @@ -1071,8 +1071,13 @@ class Daemon(AuthJSONRPCServer): return _GetFileHelper(self, search_by, val, return_json).retrieve_file() def _get_lbry_files(self): + def safe_get(sd_hash): + d = self._get_lbry_file(FileID.SD_HASH, sd_hash) + d.addErrback(log.fail(), 'Failed to get file for hash: %s', sd_hash) + return d + d = defer.DeferredList([ - self._get_lbry_file(FileID.SD_HASH, l.sd_hash) + safe_get(l.sd_hash) for l in self.lbry_file_manager.lbry_files ]) return d @@ -1417,7 +1422,7 @@ class Daemon(AuthJSONRPCServer): """ d = self._get_lbry_files() - d.addCallback(lambda r: self._render_response([d[1] for d in r], OK_CODE)) + d.addCallback(lambda r: self._render_response([d[1] for d in r if d[0]], OK_CODE)) return d