Skip to content

Commit d7ae58b

Browse files
authored
feat(app): fix choose protocol/robot slideout robot busy error logic (#11106)
closes #11060
1 parent 25cc201 commit d7ae58b

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

app/src/organisms/ChooseProtocolSlideout/__tests__/ChooseProtocolSlideout.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ describe('ChooseProtocolSlideout', () => {
109109
createRunFromProtocolSource: mockCreateRunFromProtocol,
110110
isCreatingRun: false,
111111
reset: jest.fn(),
112-
runCreationErrorCode: 'error code',
112+
runCreationErrorCode: 500,
113113
})
114114
const [{ getByRole, getByText }] = render({
115115
robot: mockConnectableRobot,
@@ -131,7 +131,7 @@ describe('ChooseProtocolSlideout', () => {
131131
createRunFromProtocolSource: mockCreateRunFromProtocol,
132132
isCreatingRun: false,
133133
reset: jest.fn(),
134-
runCreationErrorCode: '409',
134+
runCreationErrorCode: 409,
135135
})
136136
const [{ getByRole, getByText }] = render({
137137
robot: mockConnectableRobot,

app/src/organisms/ChooseProtocolSlideout/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export function ChooseProtocolSlideout(
174174
marginTop={`-${SPACING.spacing2}`}
175175
marginBottom={SPACING.spacing3}
176176
>
177-
{runCreationErrorCode === '409' ? (
177+
{runCreationErrorCode === 409 ? (
178178
<Trans
179179
t={t}
180180
i18nKey="shared:robot_is_busy_no_protocol_run_allowed"

app/src/organisms/ChooseRobotSlideout/__tests__/ChooseRobotSlideout.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ describe('ChooseRobotSlideout', () => {
227227
createRunFromProtocolSource: mockCreateRunFromProtocolSource,
228228
isCreatingRun: false,
229229
reset: jest.fn(),
230-
runCreationErrorCode: 'error code',
230+
runCreationErrorCode: 500,
231231
})
232232
const [{ getByRole, getByText }] = render({
233233
storedProtocolData: storedProtocolDataFixture,
@@ -249,7 +249,7 @@ describe('ChooseRobotSlideout', () => {
249249
createRunFromProtocolSource: mockCreateRunFromProtocolSource,
250250
isCreatingRun: false,
251251
reset: jest.fn(),
252-
runCreationErrorCode: '409',
252+
runCreationErrorCode: 409,
253253
})
254254
const [{ getByRole, getByText }] = render({
255255
storedProtocolData: storedProtocolDataFixture,

app/src/organisms/ChooseRobotSlideout/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ export function ChooseRobotSlideout(
223223
marginTop={`-${SPACING.spacing2}`}
224224
marginBottom={SPACING.spacing3}
225225
>
226-
{runCreationErrorCode === '409' ? (
226+
{runCreationErrorCode === 409 ? (
227227
<Trans
228228
t={t}
229229
i18nKey="shared:robot_is_busy_no_protocol_run_allowed"

app/src/organisms/ChooseRobotSlideout/useCreateRunFromProtocol.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface UseCreateRun {
2424
>
2525
isCreatingRun: boolean
2626
runCreationError: string | null
27-
runCreationErrorCode: string | null
27+
runCreationErrorCode: number | null
2828
reset: () => void
2929
}
3030

@@ -85,7 +85,8 @@ export function useCreateRunFromProtocol(
8585
error != null && console.error(error)
8686
error = error?.length > 255 ? t('protocol_run_general_error_msg') : error
8787

88-
const errorCode = protocolError?.code ?? runError?.code ?? null
88+
const errorCode =
89+
protocolError?.response?.status ?? runError?.response?.status ?? null
8990

9091
return {
9192
createRunFromProtocolSource: (

0 commit comments

Comments
 (0)