summaryrefslogtreecommitdiffstats
path: root/py3status
diff options
context:
space:
mode:
authorUltrabug <ultrabug@gentoo.org>2013-03-05 15:46:58 +0100
committerUltrabug <ultrabug@gentoo.org>2013-03-05 15:46:58 +0100
commita10b76458e1988532c1459d7dcc8d6f822215539 (patch)
treed03dfd61ce9e83e53988bcdc0d6cdcb53a6f4e03 /py3status
parent56299c80658445d1d96cd4b5e523873972cc654a (diff)
handle user-methods exceptions nicely
Diffstat (limited to 'py3status')
-rw-r--r--py3status/__init__.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/py3status/__init__.py b/py3status/__init__.py
index f01c306..9833bf8 100644
--- a/py3status/__init__.py
+++ b/py3status/__init__.py
@@ -162,8 +162,12 @@ def inject(j):
raise KeyError, 'cache timeout'
except KeyError:
# execute the method
- meth = getattr(my_class, my_method)
- index, result = meth(j, I3STATUS_CONFIG)
+ try:
+ meth = getattr(my_class, my_method)
+ index, result = meth(j, I3STATUS_CONFIG)
+ except Exception, err:
+ syslog(LOG_ERR, "user method %s failed (%s)" % (my_method, str(err)))
+ index, result = (0, {'name': '', 'full_text': ''})
# respect user-defined cache timeout for this module
if not result.has_key('cached_until'):