z_tilt: Raise a gcode.error() instead of directly calling respond_error()

Raising an error (instead of reporting an error) is important as only
a raised error will stop a print from virtual_sdcard.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-04-23 16:32:52 -04:00
parent 43fa41c1af
commit 3990d997de
2 changed files with 7 additions and 11 deletions

View File

@ -84,11 +84,10 @@ class QuadGantryLevel:
adjust_max = max(z_adjust)
if adjust_max > self.max_adjust:
self.gcode.respond_error(
"Aborting quad_gantry_level " +
"required adjustment %0.6f " % ( adjust_max ) +
"is greater than max_adjust %0.6f" % (self.max_adjust))
return
raise self.gcode.error("Aborting quad_gantry_level"
" required adjustment %0.6f"
" is greater than max_adjust %0.6f"
% (adjust_max, self.max_adjust))
speed = self.probe_helper.get_lift_speed()
self.z_helper.adjust_steppers(z_adjust, speed)

View File

@ -94,10 +94,8 @@ class RetryHelper:
return
error = max(z_positions) - min(z_positions)
if self.check_increase(error):
self.gcode.respond_error(
"Retries aborting: %s is increasing. %s" % (
self.value_label, self.error_msg_extra))
return
raise self.gcode.error("Retries aborting: %s is increasing. %s"
% (self.value_label, self.error_msg_extra))
self.gcode.respond_info(
"Retries: %d/%d %s: %0.6f tolerance: %0.6f" % (
self.current_retry, self.max_retries, self.value_label,
@ -106,8 +104,7 @@ class RetryHelper:
return "done"
self.current_retry += 1
if self.current_retry > self.max_retries:
self.gcode.respond_error("Too many retries")
return
raise self.gcode.error("Too many retries")
return "retry"
class ZTilt: