Catch exceptions in button handlers
This commit is contained in:
parent
7d90574212
commit
693d2ebdb7
@ -94,6 +94,7 @@ class Module(SettingsBase):
|
|||||||
else:
|
else:
|
||||||
args = []
|
args = []
|
||||||
|
|
||||||
|
try:
|
||||||
our_method = is_method_of(cb, self)
|
our_method = is_method_of(cb, self)
|
||||||
if callable(cb) and not our_method:
|
if callable(cb) and not our_method:
|
||||||
self.__log_button_event(button, cb, args, "Python callback")
|
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]
|
args = [arg.format(**self.data) for arg in args]
|
||||||
cb = cb.format(**self.data)
|
cb = cb.format(**self.data)
|
||||||
execute(cb + " " + " ".join(args), detach=True)
|
execute(cb + " " + " ".join(args), detach=True)
|
||||||
|
except Exception as e:
|
||||||
|
self.logger.critical("Exception while processing button callback: {!r}".format(e))
|
||||||
|
|
||||||
# Notify status handler
|
# Notify status handler
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user