From 516fbf4f325bbfec464d9ae00c1e22dad259af59 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 4 Apr 2019 18:37:20 -0400 Subject: [PATCH] klippy: Report the underlying error on an internal error during connect Signed-off-by: Kevin O'Connor --- klippy/klippy.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/klippy/klippy.py b/klippy/klippy.py index c3b8de55..aa8ab66a 100644 --- a/klippy/klippy.py +++ b/klippy/klippy.py @@ -147,10 +147,10 @@ class Printer: logging.exception("MCU error during connect") self._set_state("%s%s" % (str(e), message_mcu_connect_error)) return - except: + except Exception as e: logging.exception("Unhandled exception during connect") - self._set_state("Internal error during connect.%s" % ( - message_restart,)) + self._set_state("Internal error during connect: %s\n%s" % ( + str(e), message_restart,)) return try: self._set_state(message_ready) @@ -158,9 +158,10 @@ class Printer: if self.state_message is not message_ready: return cb() - except: + except Exception as e: logging.exception("Unhandled exception during ready callback") - self.invoke_shutdown("Internal error during ready callback") + self.invoke_shutdown("Internal error during ready callback: %s" % ( + str(e),)) def run(self): systime = time.time() monotime = self.reactor.monotonic()