mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-04 15:38:43 +00:00
[GTKUI] Improve error handling in torrent details
If status is missing a key required for a widget a KeyError was not always caught.
This commit is contained in:
parent
712b2715d4
commit
eda493e525
1 changed files with 7 additions and 8 deletions
|
@ -46,16 +46,15 @@ class Tab(object):
|
||||||
return self._tab_label
|
return self._tab_label
|
||||||
|
|
||||||
def get_status_for_widget(self, widget, status):
|
def get_status_for_widget(self, widget, status):
|
||||||
|
try:
|
||||||
if widget[1] is None:
|
if widget[1] is None:
|
||||||
txt = status[widget[2][0]]
|
txt = status[widget[2][0]]
|
||||||
else:
|
else:
|
||||||
try:
|
|
||||||
args = [status[key] for key in widget[2]]
|
args = [status[key] for key in widget[2]]
|
||||||
except KeyError as ex:
|
|
||||||
log.debug("Unable to get status value: %s", ex)
|
|
||||||
txt = ""
|
|
||||||
else:
|
|
||||||
txt = widget[1](*args)
|
txt = widget[1](*args)
|
||||||
|
except KeyError as ex:
|
||||||
|
log.warn("Unable to get status value: %s", ex)
|
||||||
|
txt = ""
|
||||||
return txt
|
return txt
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue