From 2c4af8f136777c295843ab5e06353c9c309db28b Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Thu, 30 Jan 2014 11:54:47 +0000 Subject: [PATCH] Fix empty message for certain tracker status errors By design alert.msg will be empty if the error code is '-1' so use a.e.message() to get the message as fallback. It was not used at replacement because when error code is not '-1' then a.e.message() will also include the error code, which we do not want. --- deluge/core/torrentmanager.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index d2621b402..366b73d65 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -1011,13 +1011,15 @@ class TorrentManager(component.Component): def on_alert_tracker_error(self, alert): """Alert handler for libtorrent tracker_error_alert""" - log.debug("on_alert_tracker_error") + error_message = decode_string(alert.msg) + if not error_message: + error_message = decode_string(alert.error.message()) + log.debug("Tracker Error Alert: %s [%s]", decode_string(alert.message()), error_message) try: torrent = self.torrents[str(alert.handle.info_hash())] except (RuntimeError, KeyError): return - tracker_status = "Error: %s" % decode_string(alert.msg) - torrent.set_tracker_status(tracker_status) + torrent.set_tracker_status("Error: " + error_message) def on_alert_storage_moved(self, alert): """Alert handler for libtorrent storage_moved_alert"""