Skip to content

Commit

Permalink
Added nicer error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
fsinapi committed Jul 21, 2023
1 parent 23cbaf1 commit 8cd95c5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions api/src/opentrons/hardware_control/backends/ot3controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,17 @@ def requires_estop(func: Wrapped) -> Wrapped:
async def wrapper(self: OT3Controller, *args: Any, **kwargs: Any) -> Any:
state = self._estop_state_machine.state
if state == EstopState.NOT_PRESENT:
raise EStopNotPresentError()
raise EStopNotPresentError(
message="An Estop must be plugged in to move the robot."
)
if state == EstopState.LOGICALLY_ENGAGED:
raise EStopActivatedError(message="Estop must be acknowledged and cleared")
raise EStopActivatedError(
message="Estop must be acknowledged and cleared to move the robot."
)
if state == EstopState.PHYSICALLY_ENGAGED:
raise EStopActivatedError(message="Estop is enaged")
raise EStopActivatedError(
message="Estop is currently engaged, robot cannot move."
)
return await func(self, *args, **kwargs)

return cast(Wrapped, wrapper)
Expand Down

0 comments on commit 8cd95c5

Please sign in to comment.