Skip to content

Commit

Permalink
fix(hardware): error details should always be strings (#13948)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsinapi authored Nov 8, 2023
1 parent 3156ed3 commit 89b795f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,13 @@ def __post_init__(self) -> None:
raise InternalMessageFormatError(
f"FirmwareUpdateData: Data address needs to be doubleword aligned."
f" {address} mod 8 equals {address % 8} and should be 0",
detail={"address": address},
detail={"address": str(address)},
)
if data_length > FirmwareUpdateDataField.NUM_BYTES:
raise InternalMessageFormatError(
f"FirmwareUpdateData: Data cannot be more than"
f" {FirmwareUpdateDataField.NUM_BYTES} bytes got {data_length}.",
detail={"size": data_length},
detail={"size": str(data_length)},
)

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ async def _run_one_group(self, group_id: int, can_messenger: CanMessenger) -> No
detail={
"missing-nodes": missing_node_msg,
"full-timeout": str(full_timeout),
"expected-time": expected_time,
"expected-time": str(expected_time),
"elapsed": str(time.time() - start_time),
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ async def capacitive_probe(
detail={
"tool": tool.name,
"sensor": sensor_id.name,
"threshold": relative_threshold_pf,
"threshold": str(relative_threshold_pf),
},
)
LOG.info(f"starting capacitive probe with threshold {threshold.to_float()}")
Expand Down
2 changes: 1 addition & 1 deletion hardware/opentrons_hardware/instruments/gripper/serials.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ def gripper_serial_val_from_parts(model: int, serialval: bytes) -> bytes:
except struct.error as e:
raise InvalidInstrumentData(
message="Invalid serial data",
detail={"model": model, "serial": serialval},
detail={"model": str(model), "serial": str(serialval)},
wrapping=[PythonException(e)],
)
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ def serial_val_from_parts(name: PipetteName, model: int, serialval: bytes) -> by
except struct.error as e:
raise InvalidInstrumentData(
message="Invalid pipette serial",
detail={"name": name, "model": model, "serial": str(serialval)},
detail={"name": str(name), "model": str(model), "serial": str(serialval)},
wrapping=[PythonException(e)],
)

0 comments on commit 89b795f

Please sign in to comment.