From eda493e5253f8fcfb983a5781dd55734e5e96c5b Mon Sep 17 00:00:00 2001 From: bendikro Date: Fri, 19 Feb 2016 15:47:27 +0100 Subject: [PATCH] [GTKUI] Improve error handling in torrent details If status is missing a key required for a widget a KeyError was not always caught. --- deluge/ui/gtkui/torrentdetails.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/deluge/ui/gtkui/torrentdetails.py b/deluge/ui/gtkui/torrentdetails.py index 29401b2c8..0db1023cb 100644 --- a/deluge/ui/gtkui/torrentdetails.py +++ b/deluge/ui/gtkui/torrentdetails.py @@ -46,16 +46,15 @@ class Tab(object): return self._tab_label def get_status_for_widget(self, widget, status): - if widget[1] is None: - txt = status[widget[2][0]] - else: - try: - args = [status[key] for key in widget[2]] - except KeyError as ex: - log.debug("Unable to get status value: %s", ex) - txt = "" + try: + if widget[1] is None: + txt = status[widget[2][0]] else: + args = [status[key] for key in widget[2]] txt = widget[1](*args) + except KeyError as ex: + log.warn("Unable to get status value: %s", ex) + txt = "" return txt