From d918032b9ca6d6b128d6004b4f94cdbf2c9a33dd Mon Sep 17 00:00:00 2001 From: 283375 Date: Sat, 21 Oct 2023 14:00:27 +0800 Subject: [PATCH] impr: log uncaught exceptions --- index.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/index.py b/index.py index 625c59d..d5a07d9 100644 --- a/index.py +++ b/index.py @@ -23,6 +23,19 @@ rootLoggerFormatter = logging.Formatter( ) +def handle_exception(exc_type, exc_value, exc_traceback): + if issubclass(exc_type, KeyboardInterrupt): + sys.__excepthook__(exc_type, exc_value, exc_traceback) + return + + rootLogger.critical( + "Uncaught exception", exc_info=(exc_type, exc_value, exc_traceback) + ) + + +sys.excepthook = handle_exception + + if __name__ == "__main__": QCoreApplication.setApplicationName("Arcaea Offline")