diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2017-12-03 19:30:49 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-12-06 18:35:51 -0500 |
commit | 80f23441dddf4f728f840d7f3b2bc4ddb42f3219 (patch) | |
tree | 934e9baafdac89ecad98d53b65462d2fd707fa44 /klippy/toolhead.py | |
parent | 3a2d16abb39f541df82489bf5b587d31077c380f (diff) | |
download | kutter-80f23441dddf4f728f840d7f3b2bc4ddb42f3219.tar.gz kutter-80f23441dddf4f728f840d7f3b2bc4ddb42f3219.tar.xz kutter-80f23441dddf4f728f840d7f3b2bc4ddb42f3219.zip |
gcode: Simplify exception handling
Translate caught exceptions into a gcode.error() exception. This way
there is one standard place to invoke respond_error(). Also, always
reset the last_position on a handled error.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/toolhead.py')
-rw-r--r-- | klippy/toolhead.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py index dde40e9b..3a73bb26 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -328,7 +328,11 @@ class ToolHead: if self.print_time > self.need_check_stall: self._check_stall() def home(self, homing_state): - self.kin.home(homing_state) + try: + self.kin.home(homing_state) + except homing.EndstopError as e: + self.motor_off() + raise def dwell(self, delay, check_stall=True): self.get_last_move_time() self.update_move_time(delay) |