Catch exceptions in button handlers

This commit is contained in:
Kenny Keslar 2016-03-02 15:57:57 -05:00
parent 7d90574212
commit 693d2ebdb7

View File

@ -94,6 +94,7 @@ class Module(SettingsBase):
else:
args = []
try:
our_method = is_method_of(cb, self)
if callable(cb) and not our_method:
self.__log_button_event(button, cb, args, "Python callback")
@ -113,6 +114,8 @@ class Module(SettingsBase):
args = [arg.format(**self.data) for arg in args]
cb = cb.format(**self.data)
execute(cb + " " + " ".join(args), detach=True)
except Exception as e:
self.logger.critical("Exception while processing button callback: {!r}".format(e))
# Notify status handler
try: