Show a warning when an action raises an Exception
This commit is contained in:
parent
c74ee7c6cb
commit
ecde43a0a3
1 changed files with 7 additions and 1 deletions
|
@ -12,6 +12,8 @@ from typing import List
|
||||||
|
|
||||||
import requests, urllib3
|
import requests, urllib3
|
||||||
|
|
||||||
|
from nicegui import ui
|
||||||
|
|
||||||
from .mixins import PingableMixin, WakeOnLanMixin
|
from .mixins import PingableMixin, WakeOnLanMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +33,11 @@ class Action:
|
||||||
self.kwargs = kwargs
|
self.kwargs = kwargs
|
||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
|
try:
|
||||||
self.c(*self.args, **self.kwargs)
|
self.c(*self.args, **self.kwargs)
|
||||||
|
except Exception as e:
|
||||||
|
ui.notify(f"Exception: {e.__str__()}", close_button=True, type="warning", timeout=0, multi_line=True)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
|
||||||
class SystemState(Enum):
|
class SystemState(Enum):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue