mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-03 15:08:40 +00:00
[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.
This commit is contained in:
parent
bf4244e8b2
commit
157f6ff62a
1 changed files with 9 additions and 1 deletions
|
@ -421,6 +421,11 @@ class WebApi(JSONComponent):
|
||||||
self.start()
|
self.start()
|
||||||
return d_methods
|
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):
|
def _on_client_disconnect(self, *args):
|
||||||
component.get('Web.PluginManager').stop()
|
component.get('Web.PluginManager').stop()
|
||||||
return self.stop()
|
return self.stop()
|
||||||
|
@ -444,7 +449,10 @@ class WebApi(JSONComponent):
|
||||||
Returns:
|
Returns:
|
||||||
Deferred: List of methods the daemon supports.
|
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
|
@export
|
||||||
def connected(self):
|
def connected(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue