Merge pull request #1246 from balena-io/1244-update-lock-weirdness

Don't wrap UpdatesLockedErrors with a detailed error
This commit is contained in:
CameronDiver 2020-04-07 14:46:30 +01:00 committed by GitHub
commit fbf4d8ac60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -774,17 +774,16 @@ export class DeviceState extends (EventEmitter as new () => DeviceStateEventEmit
retryCount,
});
} catch (e) {
const detailedError = new Error(
if (e instanceof UpdatesLockedError) {
// Forward the UpdatesLockedError directly
throw e;
}
throw new Error(
'Failed to apply state transition steps. ' +
e.message +
' Steps:' +
JSON.stringify(_.map(steps, 'action')),
);
return this.applyError(detailedError, {
force,
initial,
intermediate,
});
}
}).catch(err => {
return this.applyError(err, { force, initial, intermediate });