[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
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue