diff --git a/sbapp/main.py b/sbapp/main.py index 9537d38..fdc1f8e 100644 --- a/sbapp/main.py +++ b/sbapp/main.py @@ -1,4 +1,4 @@ -__debug_build__ = True +__debug_build__ = False __disable_shaders__ = False __version__ = "0.7.0" __variant__ = "beta" @@ -4081,7 +4081,6 @@ Thank you very much for using Free Communications Systems. self.root.ids.screen_manager.current = "broadcasts_screen" self.root.ids.nav_drawer.set_state("closed") self.sideband.setstate("app.displaying", self.root.ids.screen_manager.current) - raise OSError("Just a test") class CustomOneLineIconListItem(OneLineIconListItem): icon = StringProperty() @@ -4097,7 +4096,7 @@ class SidebandExceptionHandler(ExceptionHandler): import traceback exception_info = "".join(traceback.TracebackException.from_exception(e).format()) RNS.log(f"An unhandled {str(type(e))} exception occurred: {str(e)}", RNS.LOG_ERROR) - RNS.log(exception_info) + RNS.log(exception_info, RNS.LOG_ERROR) return ExceptionManager.PASS else: return ExceptionManager.RAISE diff --git a/sbapp/services/sidebandservice.py b/sbapp/services/sidebandservice.py index 9df9b92..397c776 100644 --- a/sbapp/services/sidebandservice.py +++ b/sbapp/services/sidebandservice.py @@ -1,5 +1,6 @@ -__debug_build__ = True +__debug_build__ = False +import sys import time import RNS from os import environ @@ -367,4 +368,19 @@ class SidebandService(): self.sideband.cleanup() self.release_locks() +def handle_exception(exc_type, exc_value, exc_traceback): + if issubclass(exc_type, KeyboardInterrupt): + sys.__excepthook__(exc_type, exc_value, exc_traceback) + return + + if exc_type == SystemExit: + sys.__excepthook__(exc_type, exc_value, exc_traceback) + return + + import traceback + exc_text = "".join(traceback.format_exception(exc_type, exc_value, exc_traceback)) + RNS.log(f"An unhandled {str(exc_type)} exception occurred: {str(exc_value)}", RNS.LOG_ERROR) + RNS.log(exc_text, RNS.LOG_ERROR) + +sys.excepthook = handle_exception SidebandService().start()