mirror of https://github.com/Desuuuu/klipper.git
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 <kevin@koconnor.net>
This commit is contained in:
parent
bf647749dd
commit
c0ea0312e5
|
@ -137,16 +137,20 @@ class Printer:
|
||||||
except (self.config_error, pins.error) as e:
|
except (self.config_error, pins.error) as e:
|
||||||
logging.exception("Config error")
|
logging.exception("Config error")
|
||||||
self._set_state("%s%s" % (str(e), message_restart))
|
self._set_state("%s%s" % (str(e), message_restart))
|
||||||
|
return
|
||||||
except msgproto.error as e:
|
except msgproto.error as e:
|
||||||
logging.exception("Protocol error")
|
logging.exception("Protocol error")
|
||||||
self._set_state("%s%s" % (str(e), message_protocol_error))
|
self._set_state("%s%s" % (str(e), message_protocol_error))
|
||||||
|
return
|
||||||
except mcu.error as e:
|
except mcu.error as e:
|
||||||
logging.exception("MCU error during connect")
|
logging.exception("MCU error during connect")
|
||||||
self._set_state("%s%s" % (str(e), message_mcu_connect_error))
|
self._set_state("%s%s" % (str(e), message_mcu_connect_error))
|
||||||
|
return
|
||||||
except:
|
except:
|
||||||
logging.exception("Unhandled exception during connect")
|
logging.exception("Unhandled exception during connect")
|
||||||
self._set_state("Internal error during connect.%s" % (
|
self._set_state("Internal error during connect.%s" % (
|
||||||
message_restart,))
|
message_restart,))
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
self._set_state(message_ready)
|
self._set_state(message_ready)
|
||||||
for cb in self.event_handlers.get("klippy:ready", []):
|
for cb in self.event_handlers.get("klippy:ready", []):
|
||||||
|
|
Loading…
Reference in New Issue