Skip to content

Commit

Permalink
fix(app): add an exit button for failed moveToAddressable area comman…
Browse files Browse the repository at this point in the history
…ds during Error Recovery
  • Loading branch information
mjhuff committed Nov 7, 2024
1 parent 78f6791 commit 96619a3
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 46 deletions.
6 changes: 4 additions & 2 deletions app/src/organisms/DropTipWizardFlows/DropTipWizardFlows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ export function DropTipWizardFlows(
// after it closes.
useEffect(() => {
return () => {
dropTipWithTypeUtils.dropTipCommands.handleCleanUpAndClose()
if (issuedCommandsType === 'setup') {
void dropTipWithTypeUtils.dropTipCommands.handleCleanUpAndClose()
}
}
}, [])
}, [issuedCommandsType])

return (
<DropTipWizard
Expand Down
6 changes: 5 additions & 1 deletion app/src/organisms/DropTipWizardFlows/hooks/errors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ export function useDropTipCommandErrors(
})
} else {
const messageText = message ?? ''
setErrorDetails({ header, message: messageText, type })
setErrorDetails({
header: header ?? t('cant_safely_drop_tips'),
message: messageText ?? t('remove_the_tips_manually'),
type,
})
}
}
}
Expand Down
84 changes: 41 additions & 43 deletions app/src/organisms/DropTipWizardFlows/hooks/useDropTipCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,51 +116,49 @@ export function useDropTipCommands({
robotType
)

if (addressableAreaFromConfig != null) {
const moveToAACommand = buildMoveToAACommand(
addressableAreaFromConfig,
pipetteId,
isPredefinedLocation,
issuedCommandsType
)
return chainRunCommands(
isFlex
? [
ENGAGE_AXES,
UPDATE_ESTIMATORS_EXCEPT_PLUNGERS,
Z_HOME,
moveToAACommand,
]
: [Z_HOME, moveToAACommand],
false
)
.then((commandData: CommandData[]) => {
const error = commandData[0].data.error
if (error != null) {
setErrorDetails({
runCommandError: error,
message: `Error moving to position: ${error.detail}`,
})
}
})
.then(resolve)
.catch(error => {
if (
fixitCommandTypeUtils != null &&
issuedCommandsType === 'fixit'
) {
fixitCommandTypeUtils.errorOverrides.generalFailure()
}
if (addressableAreaFromConfig == null) {
throw new Error('invalid addressable area.')
}

reject(
new Error(`Error issuing move to addressable area: ${error}`)
)
})
} else {
setErrorDetails({
message: `Error moving to position: invalid addressable area.`,
const moveToAACommand = buildMoveToAACommand(
addressableAreaFromConfig,
pipetteId,
isPredefinedLocation,
issuedCommandsType
)

return chainRunCommands(
isFlex
? [
ENGAGE_AXES,
UPDATE_ESTIMATORS_EXCEPT_PLUNGERS,
Z_HOME,
moveToAACommand,
]
: [Z_HOME, moveToAACommand],
false
)
.then((commandData: CommandData[]) => {
const error = commandData[0].data.error
if (error != null) {
// eslint-disable-next-line @typescript-eslint/no-throw-literal
throw error
}
resolve()
})
.catch(error => {
if (fixitCommandTypeUtils != null && issuedCommandsType === 'fixit') {
fixitCommandTypeUtils.errorOverrides.generalFailure()
} else {
setErrorDetails({
runCommandError: error,
message: error.detail
? `Error moving to position: ${error.detail}`
: 'Error moving to position: invalid addressable area.',
})
}
reject(error)
})
}
})
}

Expand Down

0 comments on commit 96619a3

Please sign in to comment.