Skip to content

Commit 3b203fb

Browse files
authored
fix(app): ensure 'blowout' and 'blowoutInPlace' commands with overpressure errors are handled in ER (#18602)
Closes RABR-775
1 parent 757a2da commit 3b203fb

File tree

2 files changed

+51
-42
lines changed

2 files changed

+51
-42
lines changed

app/src/organisms/ErrorRecoveryFlows/utils/__tests__/getErrorKind.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ describe('getErrorKind', () => {
3232
errorType: DEFINED_ERROR_TYPES.OVERPRESSURE,
3333
expectedError: ERROR_KINDS.OVERPRESSURE_WHILE_DISPENSING,
3434
},
35+
{
36+
commandType: 'blowout',
37+
errorType: DEFINED_ERROR_TYPES.OVERPRESSURE,
38+
expectedError: ERROR_KINDS.OVERPRESSURE_WHILE_DISPENSING,
39+
},
40+
{
41+
commandType: 'blowOutInPlace',
42+
errorType: DEFINED_ERROR_TYPES.OVERPRESSURE,
43+
expectedError: ERROR_KINDS.OVERPRESSURE_WHILE_DISPENSING,
44+
},
3545
{
3646
commandType: 'dropTip',
3747
errorType: DEFINED_ERROR_TYPES.TIP_PHYSICALLY_ATTACHED,
Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { ERROR_KINDS, DEFINED_ERROR_TYPES } from '../constants'
2-
3-
import type { ErrorKind } from '../types'
41
import type { FailedCommandBySource } from '/app/organisms/ErrorRecoveryFlows/hooks'
2+
import { DEFINED_ERROR_TYPES, ERROR_KINDS } from '../constants'
3+
import type { ErrorKind } from '../types'
54

65
/**
76
* Given server-side information about a failed command,
@@ -19,45 +18,45 @@ export function getErrorKind(
1918
const errorType = failedCommandByRunRecord?.error?.errorType
2019

2120
if (Boolean(errorIsDefined)) {
22-
if (
23-
commandType === 'prepareToAspirate' &&
24-
errorType === DEFINED_ERROR_TYPES.OVERPRESSURE
25-
) {
26-
return ERROR_KINDS.OVERPRESSURE_PREPARE_TO_ASPIRATE
27-
} else if (
28-
(commandType === 'aspirate' || commandType === 'aspirateInPlace') &&
29-
errorType === DEFINED_ERROR_TYPES.OVERPRESSURE
30-
) {
31-
return ERROR_KINDS.OVERPRESSURE_WHILE_ASPIRATING
32-
} else if (
33-
(commandType === 'dispense' || commandType === 'dispenseInPlace') &&
34-
errorType === DEFINED_ERROR_TYPES.OVERPRESSURE
35-
) {
36-
return ERROR_KINDS.OVERPRESSURE_WHILE_DISPENSING
37-
} else if (
38-
commandType === 'liquidProbe' &&
39-
errorType === DEFINED_ERROR_TYPES.LIQUID_NOT_FOUND
40-
) {
41-
return ERROR_KINDS.NO_LIQUID_DETECTED
42-
} else if (
43-
commandType === 'pickUpTip' &&
44-
errorType === DEFINED_ERROR_TYPES.TIP_PHYSICALLY_MISSING
45-
) {
46-
return ERROR_KINDS.TIP_NOT_DETECTED
47-
} else if (
48-
(commandType === 'dropTip' || commandType === 'dropTipInPlace') &&
49-
errorType === DEFINED_ERROR_TYPES.TIP_PHYSICALLY_ATTACHED
50-
) {
51-
return ERROR_KINDS.TIP_DROP_FAILED
52-
} else if (
53-
commandType === 'moveLabware' &&
54-
errorType === DEFINED_ERROR_TYPES.GRIPPER_MOVEMENT
55-
) {
56-
return ERROR_KINDS.GRIPPER_ERROR
57-
} else if (errorType === DEFINED_ERROR_TYPES.STALL_OR_COLLISION) {
58-
return ERROR_KINDS.STALL_OR_COLLISION
21+
switch (errorType) {
22+
case DEFINED_ERROR_TYPES.OVERPRESSURE:
23+
// The recovery flow varies dependent on the exact failed command.
24+
switch (commandType) {
25+
case 'prepareToAspirate':
26+
return ERROR_KINDS.OVERPRESSURE_PREPARE_TO_ASPIRATE
27+
case 'aspirate':
28+
case 'aspirateInPlace': {
29+
return ERROR_KINDS.OVERPRESSURE_WHILE_ASPIRATING
30+
}
31+
case 'dispense':
32+
case 'dispenseInPlace':
33+
case 'blowout':
34+
case 'blowOutInPlace':
35+
return ERROR_KINDS.OVERPRESSURE_WHILE_DISPENSING
36+
default: {
37+
console.error(`Unhandled overpressure command ${commandType}`)
38+
return ERROR_KINDS.GENERAL_ERROR
39+
}
40+
}
41+
case DEFINED_ERROR_TYPES.LIQUID_NOT_FOUND:
42+
return ERROR_KINDS.NO_LIQUID_DETECTED
43+
case DEFINED_ERROR_TYPES.TIP_PHYSICALLY_MISSING:
44+
return ERROR_KINDS.TIP_NOT_DETECTED
45+
case DEFINED_ERROR_TYPES.TIP_PHYSICALLY_ATTACHED:
46+
return ERROR_KINDS.TIP_DROP_FAILED
47+
case DEFINED_ERROR_TYPES.GRIPPER_MOVEMENT:
48+
return ERROR_KINDS.GRIPPER_ERROR
49+
case DEFINED_ERROR_TYPES.STALL_OR_COLLISION:
50+
return ERROR_KINDS.STALL_OR_COLLISION
51+
default: {
52+
console.error(`Unhandled error type ${errorType}`)
53+
return ERROR_KINDS.GENERAL_ERROR
54+
}
5955
}
56+
} else {
57+
console.warn(
58+
`Run status is "awaiting for recovery", but error is not defined: ${failedCommandByRunRecord}`
59+
)
60+
return ERROR_KINDS.GENERAL_ERROR
6061
}
61-
62-
return ERROR_KINDS.GENERAL_ERROR
6362
}

0 commit comments

Comments
 (0)