Verified Commit 3db54f05 authored by Jakob Moser's avatar Jakob Moser
Browse files

Instead of gracefully recovering, crash out violently

And let systemd handle the fallout
parent 9a22b8ea
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -49,6 +49,16 @@ def _initialize_card_reader_and_run_with_automatic_restart() -> None:
            logging.debug("Proceeding to reinitialize card reader")


def _initialize_card_reader_and_run_with_crash() -> None:
    while True:
        try:
            _initialize_card_reader_and_run()
        except CardReaderException as e:
            logging.error("Fatal: Card reader errored, reinitialization needed. Crashing the application.")
            logging.exception(e)
            exit(42)


def launch_application(password: str | None) -> None:
    if director.started:
        logging.warning(
@@ -71,7 +81,7 @@ def launch_application(password: str | None) -> None:
            director.start()
            logging.info("Registering touch screen input handler")
            touch_screen.on_screen_touched(director.screen_touched)
            _initialize_card_reader_and_run_with_automatic_restart()
            _initialize_card_reader_and_run_with_crash()
        except Exception as e:
            logging.exception(e)
            raise e