Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(app): fix broken back-compat for pre-3.13.x robots #4203

Merged
merged 2 commits into from
Oct 10, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions app/src/robot/api-client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,29 @@ export default function client(dispatch) {
const { name } = state.protocol.file
const { contents } = action.payload

const updateSession = apiSession => {
remote.session_manager.session = apiSession
// state change will trigger a session notification, which will
// dispatch a successful sessionResponse
}

freshUpload = true
remote.session_manager
.create(name, contents, fileIsBinary(state.protocol.file))
.then(apiSession => {
remote.session_manager.session = apiSession
// state change will trigger a session notification, which will
// dispatch a successful sessionResponse
.then(updateSession)
.catch(error => {
mcous marked this conversation as resolved.
Show resolved Hide resolved
// back compat: for robot versions before 3.13, Session.create takes 2 args not 3
if (
error.name === 'RemoteError' &&
error.methodName === 'create' &&
/takes 3 positional arguments/.test(error.message)
) {
return remote.session_manager
.create(name, contents)
.then(updateSession)
} else {
throw error
}
})
.catch(error => {
dispatch(actions.sessionResponse(error, null, freshUpload))
Expand Down