Skip to content

Commit

Permalink
catch proper exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
ahiuchingau committed Jan 17, 2025
1 parent 68a5f74 commit 78dfdcd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from ...errors import (
ErrorOccurrence,
CannotPerformModuleAction,
LocationIsOccupiedError,
)
from ...state import update_types
from ...types import ModuleLocation
Expand Down Expand Up @@ -72,7 +73,7 @@ async def execute(self, params: RetrieveParams) -> SuccessData[RetrieveResult]:

try:
self._state_view.labware.raise_if_labware_in_location(stacker_loc)
except Exception:
except LocationIsOccupiedError:
raise CannotPerformModuleAction(
"Cannot retrieve a labware from Flex Stacker if the carriage is occupied"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
from pydantic import BaseModel, Field

from ..command import AbstractCommandImpl, BaseCommand, BaseCommandCreate, SuccessData
from ...errors import ErrorOccurrence, CannotPerformModuleAction
from ...errors import (
ErrorOccurrence,
CannotPerformModuleAction,
LabwareNotLoadedOnModuleError,
)
from ...state import update_types
from ...types import OFF_DECK_LOCATION

Expand Down Expand Up @@ -59,7 +63,7 @@ async def execute(self, params: StoreParams) -> SuccessData[StoreResult]:

try:
lw_id = self._state_view.labware.get_id_by_module(params.moduleId)
except Exception:
except LabwareNotLoadedOnModuleError:
raise CannotPerformModuleAction(
"Cannot store labware if Flex Stacker carriage is empty"
)
Expand Down

0 comments on commit 78dfdcd

Please sign in to comment.