diff --git a/api/src/opentrons/protocol_engine/errors/__init__.py b/api/src/opentrons/protocol_engine/errors/__init__.py index ee4447b38bf..304f7db1fff 100644 --- a/api/src/opentrons/protocol_engine/errors/__init__.py +++ b/api/src/opentrons/protocol_engine/errors/__init__.py @@ -71,7 +71,8 @@ CommandNotAllowedError, InvalidLiquidHeightFound, LiquidHeightUnknownError, - InvalidWellDefinitionError, + IncompleteLabwareDefinitionError, + IncompleteWellDefinitionError, OperationLocationNotInWellError, InvalidDispenseVolumeError, ) @@ -153,7 +154,8 @@ "CommandNotAllowedError", "InvalidLiquidHeightFound", "LiquidHeightUnknownError", - "InvalidWellDefinitionError", + "IncompleteLabwareDefinitionError", + "IncompleteWellDefinitionError", "OperationLocationNotInWellError", "InvalidDispenseVolumeError", ] diff --git a/api/src/opentrons/protocol_engine/errors/exceptions.py b/api/src/opentrons/protocol_engine/errors/exceptions.py index dad964a92c3..27987e5d91e 100644 --- a/api/src/opentrons/protocol_engine/errors/exceptions.py +++ b/api/src/opentrons/protocol_engine/errors/exceptions.py @@ -1071,8 +1071,8 @@ def __init__( super().__init__(ErrorCodes.GENERAL_ERROR, message, details, wrapping) -class InvalidWellDefinitionError(ProtocolEngineError): - """Raised when an InnerWellGeometry definition is invalid.""" +class IncompleteLabwareDefinitionError(ProtocolEngineError): + """Raised when a labware definition lacks innerLabwareGeometry in general or for a specific well_id.""" def __init__( self, @@ -1080,7 +1080,20 @@ def __init__( details: Optional[Dict[str, Any]] = None, wrapping: Optional[Sequence[EnumeratedError]] = None, ) -> None: - """Build an InvalidWellDefinitionError.""" + """Build an IncompleteLabwareDefinitionError.""" + super().__init__(ErrorCodes.GENERAL_ERROR, message, details, wrapping) + + +class IncompleteWellDefinitionError(ProtocolEngineError): + """Raised when a well definition lacks a geometryDefinitionId.""" + + def __init__( + self, + message: Optional[str] = None, + details: Optional[Dict[str, Any]] = None, + wrapping: Optional[Sequence[EnumeratedError]] = None, + ) -> None: + """Build an IncompleteWellDefinitionError.""" super().__init__(ErrorCodes.GENERAL_ERROR, message, details, wrapping) diff --git a/api/src/opentrons/protocol_engine/state/labware.py b/api/src/opentrons/protocol_engine/state/labware.py index 907c9d20e2e..b852311163b 100644 --- a/api/src/opentrons/protocol_engine/state/labware.py +++ b/api/src/opentrons/protocol_engine/state/labware.py @@ -500,23 +500,22 @@ def get_well_geometry( self, labware_id: str, well_name: Optional[str] = None ) -> InnerWellGeometry: """Get a well's inner geometry by labware and well name.""" - # TODO(pbm, 10-11-24): wordsmith this error labware_def = self.get_definition(labware_id) if labware_def.innerLabwareGeometry is None: - raise errors.InvalidWellDefinitionError( - message=f"No innerLabwareGeometry found for labware_id: {labware_id}." + raise errors.IncompleteLabwareDefinitionError( + message=f"No innerLabwareGeometry found in labware definition for labware_id: {labware_id}." ) well_def = self.get_well_definition(labware_id, well_name) well_id = well_def.geometryDefinitionId if well_id is None: - raise errors.InvalidWellDefinitionError( - message=f"No geometryDefinitionId found for well: {well_name} in labware_id: {labware_id}" + raise errors.IncompleteWellDefinitionError( + message=f"No geometryDefinitionId found in well definition for well: {well_name} in labware_id: {labware_id}" ) else: well_geometry = labware_def.innerLabwareGeometry.get(well_id) if well_geometry is None: - raise errors.InvalidWellDefinitionError( - message=f"No innerLabwareGeometry found for well_id: {well_id} in labware_id: {labware_id}" + raise errors.IncompleteLabwareDefinitionError( + message=f"No innerLabwareGeometry found in labware definition for well_id: {well_id} in labware_id: {labware_id}" ) return well_geometry