theme: continue execution after failure for one theme (#50)

This commit is contained in:
sweenu
2025-09-09 05:59:04 +02:00
committed by GitHub
parent c20bc567a4
commit 3319d2ca19
3 changed files with 57 additions and 26 deletions
+20
View File
@@ -0,0 +1,20 @@
from time import strftime
def log_message(message: str) -> None:
timestamp = strftime("%Y-%m-%d %H:%M:%S")
print(f"[{timestamp}] {message}")
def log_exception(func):
"""Log exceptions to stdout instead of raising
Used by the `apply_()` functions so that an exception, when applying
a theme, does not prevent the other themes from being applied.
"""
def wrapper(*args, **kwargs):
try:
func(*args, **kwargs)
except Exception as e:
log_message(f'Error during execution of "{func.__name__}()": {str(e)}')
return wrapper