From 582803dccc93888f4c5d35bcdd74385f0e97468a Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Sun, 9 Mar 2025 16:34:53 +0000 Subject: [PATCH] Put more info in ApplicationError dialog Show it after dumping error to stderr --- app/log.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/log.py b/app/log.py index c729025..178e31f 100644 --- a/app/log.py +++ b/app/log.py @@ -80,8 +80,6 @@ log = logging.getLogger(Config.LOG_NAME) def handle_exception(exc_type, exc_value, exc_traceback): error = str(exc_value) - if QApplication.instance() is not None: - QMessageBox.critical(None, "Application Error", error) if issubclass(exc_type, ApplicationError): log.error(error) else: @@ -104,6 +102,10 @@ def handle_exception(exc_type, exc_value, exc_traceback): "Exception (log_uncaught_exceptions) from musicmuster", msg, ) + if QApplication.instance() is not None: + fname = os.path.split(exc_traceback.tb_frame.f_code.co_filename)[1] + msg = f"ApplicationError: {error}\nat {fname}:{exc_traceback.tb_lineno}" + QMessageBox.critical(None, "Application Error", msg) sys.excepthook = handle_exception