Skip to content

Commit

Permalink
gcode: Don't export respond_error()
Browse files Browse the repository at this point in the history
Don't export the respond_error() method as callers should raise a
gcode.error() instead.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
  • Loading branch information
KevinOConnor committed Apr 24, 2020
1 parent 568a0da commit 6152454
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions klippy/gcode.py
Expand Up @@ -123,7 +123,7 @@ def _action_respond_info(self, msg):
self.respond_info(msg)
return ""
def _action_respond_error(self, msg):
self.respond_error(msg)
self._respond_error(msg)
return ""
def _get_gcode_position(self):
p = [lp - bp for lp, bp in zip(self.last_position, self.base_position)]
Expand Down Expand Up @@ -234,7 +234,7 @@ def _process_commands(self, commands, need_ack=True):
try:
handler(params)
except self.error as e:
self.respond_error(str(e))
self._respond_error(str(e))
self.reset_last_position()
self.printer.send_event("gcode:command_error")
if not need_ack:
Expand All @@ -243,7 +243,7 @@ def _process_commands(self, commands, need_ack=True):
msg = 'Internal error on command:"%s"' % (cmd,)
logging.exception(msg)
self.printer.invoke_shutdown(msg)
self.respond_error(msg)
self._respond_error(msg)
if not need_ack:
raise
self.ack()
Expand Down Expand Up @@ -328,7 +328,7 @@ def respond_info(self, msg, log=True):
logging.info(msg)
lines = [l.strip() for l in msg.strip().split('\n')]
self.respond("// " + "\n// ".join(lines))
def respond_error(self, msg):
def _respond_error(self, msg):
logging.warning(msg)
lines = msg.strip().split('\n')
if len(lines) > 1:
Expand Down Expand Up @@ -412,7 +412,7 @@ def wait_for_temperature(self, heater):
# G-Code special command handlers
def cmd_default(self, params):
if not self.is_printer_ready:
self.respond_error(self.printer.get_state_message())
raise self.error(self.printer.get_state_message())
return
cmd = params.get('#command')
if not cmd:
Expand Down Expand Up @@ -683,7 +683,7 @@ def cmd_STATUS(self, params):
return
msg = self.printer.get_state_message()
msg = msg.rstrip() + "\nKlipper state: Not ready"
self.respond_error(msg)
raise self.error(msg)
cmd_HELP_when_not_ready = True
def cmd_HELP(self, params):
cmdhelp = []
Expand Down

0 comments on commit 6152454

Please sign in to comment.