summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalum Lind <calumlind@gmail.com>2018-11-16 13:03:10 +0000
committerCalum Lind <calumlind@gmail.com>2018-11-16 15:06:30 +0000
commit157f6ff62a355d42164922015f6da9df3670fea8 (patch)
treeeec1c1ceacdabc2a901172c62aa2a4813b410716
parentbf4244e8b22094d62bf429b4535c67940134af34 (diff)
downloaddeluge-157f6ff62a355d42164922015f6da9df3670fea8.tar.gz
deluge-157f6ff62a355d42164922015f6da9df3670fea8.tar.bz2
deluge-157f6ff62a355d42164922015f6da9df3670fea8.zip
[WebUI] Catch unhandled 'Bad host id' exception
The bad host id error usually occurs on webui when the 'default_daemon' key in web.conf does not exist in hostlist.conf. Added a errback method to output a more useful log message.
-rw-r--r--deluge/ui/web/json_api.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py
index 536a3408c..69eb1e7a2 100644
--- a/deluge/ui/web/json_api.py
+++ b/deluge/ui/web/json_api.py
@@ -421,6 +421,11 @@ class WebApi(JSONComponent):
self.start()
return d_methods
+ def _on_client_connect_fail(self, result, host_id):
+ log.error(
+ 'Unable to connect to daemon, check host_id "%s" is correct.', host_id
+ )
+
def _on_client_disconnect(self, *args):
component.get('Web.PluginManager').stop()
return self.stop()
@@ -444,7 +449,10 @@ class WebApi(JSONComponent):
Returns:
Deferred: List of methods the daemon supports.
"""
- return self.hostlist.connect_host(host_id).addCallback(self._on_client_connect)
+ d = self.hostlist.connect_host(host_id)
+ d.addCallback(self._on_client_connect)
+ d.addErrback(self._on_client_connect_fail, host_id)
+ return d
@export
def connected(self):