From c0ea0312e548afe1de8a34a59b179db4ead63f36 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 8 Jan 2019 13:46:26 -0500 Subject: [PATCH] klippy: Fix error handling during connect phase Make sure to exit the _connect() method if a connect event handler raises an error. Signed-off-by: Kevin O'Connor --- klippy/klippy.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/klippy/klippy.py b/klippy/klippy.py index 51ec2bd6..d11959e2 100644 --- a/klippy/klippy.py +++ b/klippy/klippy.py @@ -137,16 +137,20 @@ class Printer: except (self.config_error, pins.error) as e: logging.exception("Config error") self._set_state("%s%s" % (str(e), message_restart)) + return except msgproto.error as e: logging.exception("Protocol error") self._set_state("%s%s" % (str(e), message_protocol_error)) + return except mcu.error as e: logging.exception("MCU error during connect") self._set_state("%s%s" % (str(e), message_mcu_connect_error)) + return except: logging.exception("Unhandled exception during connect") self._set_state("Internal error during connect.%s" % ( message_restart,)) + return try: self._set_state(message_ready) for cb in self.event_handlers.get("klippy:ready", []):