[core/module] Add error widgets if a module throws
Module should have to care less about thrown exceptions.
This commit is contained in:
parent
cb3482ae27
commit
a1aec8fff6
7 changed files with 36 additions and 4 deletions
|
@ -38,6 +38,14 @@ class Module(core.input.Object):
|
|||
def update(self):
|
||||
pass
|
||||
|
||||
def update_wrapper(self):
|
||||
try:
|
||||
self.update()
|
||||
except Exception as e:
|
||||
module = Error(self._config, 'error', str(e))
|
||||
self._widgets = [module.widgets()[0]]
|
||||
self.update = module.update
|
||||
|
||||
def name(self):
|
||||
return self._name if self._name else self.module_name()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue