aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/mcu.py
diff options
context:
space:
mode:
Diffstat (limited to 'klippy/mcu.py')
-rw-r--r--klippy/mcu.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/klippy/mcu.py b/klippy/mcu.py
index 5e31602c..fe540962 100644
--- a/klippy/mcu.py
+++ b/klippy/mcu.py
@@ -358,18 +358,20 @@ class RetryAsyncCommand:
query_time = self.reactor.monotonic()
if query_time > first_query_time + self.TIMEOUT_TIME:
self.serial.register_response(None, self.name, self.oid)
- raise error("Timeout on wait for '%s' response" % (self.name,))
+ raise serialhdl.error("Timeout on wait for '%s' response"
+ % (self.name,))
self.serial.raw_send(cmd, minclock, minclock, cmd_queue)
# Wrapper around query commands
class CommandQueryWrapper:
def __init__(self, serial, msgformat, respformat, oid=None,
- cmd_queue=None, is_async=False):
+ cmd_queue=None, is_async=False, error=serialhdl.error):
self._serial = serial
self._cmd = serial.get_msgparser().lookup_command(msgformat)
serial.get_msgparser().lookup_command(respformat)
self._response = respformat.split()[0]
self._oid = oid
+ self._error = error
self._xmit_helper = serialhdl.SerialRetryCommand
if is_async:
self._xmit_helper = RetryAsyncCommand
@@ -383,7 +385,7 @@ class CommandQueryWrapper:
try:
return xh.get_response(cmd, self._cmd_queue, minclock, reqclock)
except serialhdl.error as e:
- raise error(str(e))
+ raise self._error(str(e))
# Wrapper around command sending
class CommandWrapper:
@@ -688,7 +690,7 @@ class MCU:
def lookup_query_command(self, msgformat, respformat, oid=None,
cq=None, is_async=False):
return CommandQueryWrapper(self._serial, msgformat, respformat, oid,
- cq, is_async)
+ cq, is_async, self._printer.command_error)
def try_lookup_command(self, msgformat):
try:
return self.lookup_command(msgformat)