Put more info in ApplicationError dialog
Show it after dumping error to stderr
This commit is contained in:
parent
5f9fd31dfd
commit
582803dccc
@ -80,8 +80,6 @@ log = logging.getLogger(Config.LOG_NAME)
|
|||||||
|
|
||||||
def handle_exception(exc_type, exc_value, exc_traceback):
|
def handle_exception(exc_type, exc_value, exc_traceback):
|
||||||
error = str(exc_value)
|
error = str(exc_value)
|
||||||
if QApplication.instance() is not None:
|
|
||||||
QMessageBox.critical(None, "Application Error", error)
|
|
||||||
if issubclass(exc_type, ApplicationError):
|
if issubclass(exc_type, ApplicationError):
|
||||||
log.error(error)
|
log.error(error)
|
||||||
else:
|
else:
|
||||||
@ -104,6 +102,10 @@ def handle_exception(exc_type, exc_value, exc_traceback):
|
|||||||
"Exception (log_uncaught_exceptions) from musicmuster",
|
"Exception (log_uncaught_exceptions) from musicmuster",
|
||||||
msg,
|
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
|
sys.excepthook = handle_exception
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user