From 7b1276f0b128e0a842d908f06ffee7fa11593b22 Mon Sep 17 00:00:00 2001 From: Riaan Doorduin Date: Sat, 17 Oct 2026 13:12:41 +0200 Subject: [PATCH] App: show startup errors in a message box and log them mygarmin-app.exe has no console, so failures were silent. Co-Authored-By: Claude Opus 5.5 --- src/mygarmin/app/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mygarmin/app/__init__.py b/src/mygarmin/app/__init__.py index fdaddc9..18379e0 100644 --- a/src/mygarmin/app/__init__.py +++ b/src/mygarmin/app/__init__.py @@ -205,6 +205,18 @@ class Api: def main(): + """Entry point of mygarmin-app.exe. It has no console, so any startup error is shown in a message box and logged.""" + try: _main() + except BaseException as e: + if isinstance(e, SystemExit) and not e.code: raise + log = os.path.join(os.path.dirname(STATE), 'app.log'); os.makedirs(os.path.dirname(log), exist_ok=True) + open(log, 'a', encoding='utf-8').write(f'{datetime.now():%Y-%m-%d %H:%M:%S}\n{traceback.format_exc()}\n') + if sys.platform == 'win32': + import ctypes + ctypes.windll.user32.MessageBoxW(None, f'myGarmin could not start:\n\n{e}\n\nDetails: {log}', 'myGarmin', 0x10) + raise + +def _main(): try: import webview from webview.dom import DOMEventHandler