Changeset 00757a


Ignore:
Timestamp:
11/05/2015 10:23:35 PM (10 years ago)
Author:
Calum Lind <calumlind+deluge@gmail.com>
Children:
83cecc
Parents:
639eef
git-author:
Calum Lind <calumlind+deluge@gmail.com> (01/30/2014 11:54:47 AM)
git-committer:
Calum Lind <calumlind+deluge@gmail.com> (11/05/2015 10:23:35 PM)
Message:

[Core] Empty error message fix with certain trackers

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • deluge/core/torrentmanager.py

    r639eef r00757a  
    10441044
    10451045    def on_alert_tracker_error(self, alert):
    1046         log.debug("on_alert_tracker_error")
     1046        """Alert handler for libtorrent tracker_error_alert"""
     1047        error_message = decode_string(alert.msg)
     1048        # If alert.msg is empty then it's a '-1' code so fallback to a.e.message. Note that alert.msg
     1049        # cannot be replaced by a.e.message because the code is included in the string (for non-'-1').
     1050        if not error_message:
     1051            error_message = decode_string(alert.error.message())
     1052        log.debug("Tracker Error Alert: %s [%s]", decode_string(alert.message()), error_message)
    10471053        try:
    10481054            torrent = self.torrents[str(alert.handle.info_hash())]
    1049         except:
    1050             return
    1051         tracker_status = "%s: %s" % (_("Error"), alert.msg)
    1052         torrent.set_tracker_status(tracker_status)
     1055        except (RuntimeError, KeyError):
     1056            return
     1057
     1058        torrent.set_tracker_status("Error: " + error_message)
    10531059
    10541060    def on_alert_storage_moved(self, alert):
Note: See TracChangeset for help on using the changeset viewer.