Skip to content

Commit

Permalink
feat(app): add overpressure during prepare to aspirate to error recovery
Browse files Browse the repository at this point in the history
  • Loading branch information
mjhuff committed Oct 21, 2024
1 parent 397f079 commit 7e04681
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import type { RunCommandError, RunTimeCommand } from '@opentrons/shared-data'

describe('getErrorKind', () => {
it.each([
{
commandType: 'prepareToAspirate',
errorType: DEFINED_ERROR_TYPES.OVERPRESSURE,
expectedError: ERROR_KINDS.OVERPRESSURE_PREPARE_TO_ASPIRATE,
},
{
commandType: 'aspirate',
errorType: DEFINED_ERROR_TYPES.OVERPRESSURE,
Expand Down
75 changes: 39 additions & 36 deletions app/src/organisms/ErrorRecoveryFlows/utils/getErrorKind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,44 @@ export function getErrorKind(failedCommand: RunTimeCommand | null): ErrorKind {
const errorIsDefined = failedCommand?.error?.isDefined ?? false

Check failure on line 12 in app/src/organisms/ErrorRecoveryFlows/utils/getErrorKind.ts

View workflow job for this annotation

GitHub Actions / js checks

'errorIsDefined' is assigned a value but never used
const errorType = failedCommand?.error?.errorType

Check failure on line 13 in app/src/organisms/ErrorRecoveryFlows/utils/getErrorKind.ts

View workflow job for this annotation

GitHub Actions / js checks

'errorType' is assigned a value but never used

if (errorIsDefined) {
// todo(mm, 2024-07-02): Also handle aspirateInPlace and dispenseInPlace.
// https://opentrons.atlassian.net/browse/EXEC-593
if (
(commandType === 'aspirate' || commandType === 'aspirateInPlace') &&
errorType === DEFINED_ERROR_TYPES.OVERPRESSURE
) {
return ERROR_KINDS.OVERPRESSURE_WHILE_ASPIRATING
} else if (
(commandType === 'dispense' || commandType === 'dispenseInPlace') &&
errorType === DEFINED_ERROR_TYPES.OVERPRESSURE
) {
return ERROR_KINDS.OVERPRESSURE_WHILE_DISPENSING
} else if (
commandType === 'liquidProbe' &&
errorType === DEFINED_ERROR_TYPES.LIQUID_NOT_FOUND
) {
return ERROR_KINDS.NO_LIQUID_DETECTED
} else if (
commandType === 'pickUpTip' &&
errorType === DEFINED_ERROR_TYPES.TIP_PHYSICALLY_MISSING
) {
return ERROR_KINDS.TIP_NOT_DETECTED
} else if (
(commandType === 'dropTip' || commandType === 'dropTipInPlace') &&
errorType === DEFINED_ERROR_TYPES.TIP_PHYSICALLY_ATTACHED
) {
return ERROR_KINDS.TIP_DROP_FAILED
} else if (
commandType === 'moveLabware' &&
errorType === DEFINED_ERROR_TYPES.GRIPPER_MOVEMENT
) {
return ERROR_KINDS.GRIPPER_ERROR
}
}
// if (errorIsDefined) {
// if (
// commandType === 'prepareToAspirate' &&
// errorType === DEFINED_ERROR_TYPES.OVERPRESSURE
// ) {
// return ERROR_KINDS.OVERPRESSURE_PREPARE_TO_ASPIRATE
// } else if (
// (commandType === 'aspirate' || commandType === 'aspirateInPlace') &&
// errorType === DEFINED_ERROR_TYPES.OVERPRESSURE
// ) {
// return ERROR_KINDS.OVERPRESSURE_WHILE_ASPIRATING
// } else if (
// (commandType === 'dispense' || commandType === 'dispenseInPlace') &&
// errorType === DEFINED_ERROR_TYPES.OVERPRESSURE
// ) {
// return ERROR_KINDS.OVERPRESSURE_WHILE_DISPENSING
// } else if (
// commandType === 'liquidProbe' &&
// errorType === DEFINED_ERROR_TYPES.LIQUID_NOT_FOUND
// ) {
// return ERROR_KINDS.NO_LIQUID_DETECTED
// } else if (
// commandType === 'pickUpTip' &&
// errorType === DEFINED_ERROR_TYPES.TIP_PHYSICALLY_MISSING
// ) {
// return ERROR_KINDS.TIP_NOT_DETECTED
// } else if (
// (commandType === 'dropTip' || commandType === 'dropTipInPlace') &&
// errorType === DEFINED_ERROR_TYPES.TIP_PHYSICALLY_ATTACHED
// ) {
// return ERROR_KINDS.TIP_DROP_FAILED
// } else if (
// commandType === 'moveLabware' &&
// errorType === DEFINED_ERROR_TYPES.GRIPPER_MOVEMENT
// ) {
// return ERROR_KINDS.GRIPPER_ERROR
// }
// }

return ERROR_KINDS.GENERAL_ERROR
return ERROR_KINDS.OVERPRESSURE_PREPARE_TO_ASPIRATE
}

0 comments on commit 7e04681

Please sign in to comment.