From 73d06d823331b6666fb3dc8872e7580809e4d588 Mon Sep 17 00:00:00 2001
From: Mike Cousins
Date: Mon, 15 Jul 2019 15:12:20 -0400
Subject: [PATCH] fix(app): Do not swallow protocol run errors (#3723)
Fixes #1828
---
app/src/components/RunLog/SessionAlert.js | 56 +++++++++++++++--------
app/src/robot/reducer/session.js | 12 ++++-
2 files changed, 47 insertions(+), 21 deletions(-)
diff --git a/app/src/components/RunLog/SessionAlert.js b/app/src/components/RunLog/SessionAlert.js
index e8035b500f5..b849dd76d1c 100644
--- a/app/src/components/RunLog/SessionAlert.js
+++ b/app/src/components/RunLog/SessionAlert.js
@@ -12,42 +12,60 @@ type Props = {
export default function SessionAlert(props: Props) {
const { sessionStatus, className, onResetClick } = props
- const completeMessage = (
-
- Run complete! Reset run to run protocol
- again.
-
- )
- const pauseMessage = 'Run paused'
- const cancelMessage = (
-
- Run canceled. Reset run to run protocol
- again.
-
- )
-
switch (sessionStatus) {
case 'finished':
return (
+ Run complete! Reset run to run
+ protocol again.
+
+ }
/>
)
+
case 'paused':
return (
)
+
case 'stopped':
return (
-
+
+ Run canceled. Reset run to run
+ protocol again.
+
+ }
+ />
+ )
+
+ case 'error':
+ return (
+
+ Run encountered an error. Reset run{' '}
+ to run protocol again. Please contact support if you need help
+ resolving this issue.
+
+ }
+ />
)
+
default:
return null
}
diff --git a/app/src/robot/reducer/session.js b/app/src/robot/reducer/session.js
index f8aea6760b1..2a03cc1d35d 100644
--- a/app/src/robot/reducer/session.js
+++ b/app/src/robot/reducer/session.js
@@ -128,7 +128,7 @@ export default function sessionReducer(
function handleSessionUpdate(state: State, action: SessionUpdateAction): State {
const {
- payload: { state: sessionState, startTime, lastCommand },
+ payload: { state: sessionStateUpdate, startTime, lastCommand },
} = action
let { protocolCommandsById } = state
@@ -144,6 +144,13 @@ function handleSessionUpdate(state: State, action: SessionUpdateAction): State {
}
}
+ // TODO(mc, 2019-07-15): remove this workaround when API issue is resolved
+ // https://github.com/Opentrons/opentrons/issues/2994
+ const sessionState =
+ state.state === 'stopped' && sessionStateUpdate === 'error'
+ ? 'stopped'
+ : sessionStateUpdate
+
return { ...state, state: sessionState, startTime, protocolCommandsById }
}
@@ -182,8 +189,9 @@ function handleRun(state: State, action: any): State {
function handleRunResponse(state: State, action: any): State {
const { error, payload } = action
- if (error)
+ if (error) {
return { ...state, runRequest: { inProgress: false, error: payload } }
+ }
return { ...state, runRequest: { inProgress: false, error: null } }
}