From ecde43a0a31a6a2c1d43d99590ffccbc1e21663e Mon Sep 17 00:00:00 2001 From: ChaoticByte Date: Fri, 28 Feb 2025 15:09:07 +0100 Subject: [PATCH] Show a warning when an action raises an Exception --- dashboard/system.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dashboard/system.py b/dashboard/system.py index f9ae0f5..388de40 100644 --- a/dashboard/system.py +++ b/dashboard/system.py @@ -12,6 +12,8 @@ from typing import List import requests, urllib3 +from nicegui import ui + from .mixins import PingableMixin, WakeOnLanMixin @@ -31,7 +33,11 @@ class Action: self.kwargs = kwargs def __call__(self): - self.c(*self.args, **self.kwargs) + try: + 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):