mirror of
https://github.com/markqvist/Sideband.git
synced 2024-12-28 08:59:30 -05:00
Added exception handler
This commit is contained in:
parent
54e5256ea4
commit
93a0b5fb55
@ -1,4 +1,4 @@
|
|||||||
__debug_build__ = True
|
__debug_build__ = False
|
||||||
__disable_shaders__ = False
|
__disable_shaders__ = False
|
||||||
__version__ = "0.7.0"
|
__version__ = "0.7.0"
|
||||||
__variant__ = "beta"
|
__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.screen_manager.current = "broadcasts_screen"
|
||||||
self.root.ids.nav_drawer.set_state("closed")
|
self.root.ids.nav_drawer.set_state("closed")
|
||||||
self.sideband.setstate("app.displaying", self.root.ids.screen_manager.current)
|
self.sideband.setstate("app.displaying", self.root.ids.screen_manager.current)
|
||||||
raise OSError("Just a test")
|
|
||||||
|
|
||||||
class CustomOneLineIconListItem(OneLineIconListItem):
|
class CustomOneLineIconListItem(OneLineIconListItem):
|
||||||
icon = StringProperty()
|
icon = StringProperty()
|
||||||
@ -4097,7 +4096,7 @@ class SidebandExceptionHandler(ExceptionHandler):
|
|||||||
import traceback
|
import traceback
|
||||||
exception_info = "".join(traceback.TracebackException.from_exception(e).format())
|
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(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
|
return ExceptionManager.PASS
|
||||||
else:
|
else:
|
||||||
return ExceptionManager.RAISE
|
return ExceptionManager.RAISE
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
__debug_build__ = True
|
__debug_build__ = False
|
||||||
|
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
import RNS
|
import RNS
|
||||||
from os import environ
|
from os import environ
|
||||||
@ -367,4 +368,19 @@ class SidebandService():
|
|||||||
self.sideband.cleanup()
|
self.sideband.cleanup()
|
||||||
self.release_locks()
|
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()
|
SidebandService().start()
|
||||||
|
Loading…
Reference in New Issue
Block a user