diff options
| author | Ultrabug <ultrabug@gentoo.org> | 2013-03-05 15:46:58 +0100 |
|---|---|---|
| committer | Ultrabug <ultrabug@gentoo.org> | 2013-03-05 15:46:58 +0100 |
| commit | a10b76458e1988532c1459d7dcc8d6f822215539 (patch) | |
| tree | d03dfd61ce9e83e53988bcdc0d6cdcb53a6f4e03 /py3status/__init__.py | |
| parent | 56299c80658445d1d96cd4b5e523873972cc654a (diff) | |
handle user-methods exceptions nicely
Diffstat (limited to 'py3status/__init__.py')
| -rw-r--r-- | py3status/__init__.py | 8 |
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'): |
