try to catch unicode error

This commit is contained in:
Marcos Pinto 2008-01-21 23:51:41 +00:00
commit 74a1f60e42

View file

@ -727,7 +727,7 @@ Space:") + " " + nice_free)
elif event['event_type'] is self.constants['EVENT_TRACKER_ALERT']:
match = re.search('tracker:\s*".*"\s*(.*)', event["message"])
message = match and match.groups()[0] or ""
try:
tracker_status = "%s: %s (%s=%s, %s=%s)" % \
(_("Alert"), message,
_("HTTP code"), event["status_code"],
@ -736,6 +736,10 @@ Space:") + " " + nice_free)
self.set_supp_torrent_state_val(event['unique_ID'],
"tracker_status",
tracker_status)
except Exception, e:
print "There was a problem displaying a tracker alert. Most\
likely the tracker did not responsd in utf-8.", e
elif event['event_type'] is self.constants['EVENT_TRACKER_WARNING']:
# Probably will need proper formatting later, not tested yet
tracker_status = '%s: %s' % (_("Warning"), event["message"])