Skip to content

Commit

Permalink
chore(api): raise EnumeratedError for failed status check (#15241)
Browse files Browse the repository at this point in the history
If you did a motor_engaged() query and the node didn't respond, you'd
get a KeyError wrapped in a 4000 error, which isn't correct or useful.
Make that a 1000 error instead.
  • Loading branch information
sfoster1 authored May 22, 2024
1 parent 3896d9d commit 7fc230f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion api/src/opentrons/hardware_control/backends/ot3controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@
FirmwareUpdateRequiredError,
FailedGripperPickupError,
LiquidNotFoundError,
CommunicationError,
PythonException,
)

from .subsystem_manager import SubsystemManager
Expand Down Expand Up @@ -1186,7 +1188,14 @@ async def update_engaged_axes(self) -> None:
async def is_motor_engaged(self, axis: Axis) -> bool:
node = axis_to_node(axis)
result = await get_motor_enabled(self._messenger, {node})
engaged = result[node]
try:
engaged = result[node]
except KeyError as ke:
raise CommunicationError(
message=f"No response from {node.name} for motor engagement query",
detail={"node": node.name},
wrapping=[PythonException(ke)],
) from ke
self._engaged_axes.update({axis: engaged})
return engaged

Expand Down

0 comments on commit 7fc230f

Please sign in to comment.