error installationState is in the error details

This commit is contained in:
Johannes Zellner
2025-07-23 15:31:25 +02:00
parent 0cdfd5e62b
commit 6c1045c545
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -1296,7 +1296,7 @@ async function addTask(appId, installationState, task, auditSource) {
assert.strictEqual(typeof auditSource, 'object');
const { args, values } = task;
// TODO: match the SQL logic to match checkAppState. this means checking the error.installationState and installationState. Unfortunately, former is JSON right now
// TODO: match the SQL logic to match checkAppState. this means checking the error.details.installationState and installationState. Unfortunately, former is JSON right now
const requiredState = null; // 'requiredState' in task ? task.requiredState : exports.ISTATE_INSTALLED;
const scheduleNow = 'scheduleNow' in task ? task.scheduleNow : true;
const requireNullTaskId = 'requireNullTaskId' in task ? task.requireNullTaskId : true;
@@ -1320,7 +1320,7 @@ function checkAppState(app, state) {
if (app.installationState === exports.ISTATE_ERROR) {
// allow task to be called again if that was the errored task
if (app.error.installationState === state) return null;
if (app.error.details?.installationState === state) return null;
// allow uninstall from any state
if (state !== exports.ISTATE_PENDING_UNINSTALL && state !== exports.ISTATE_PENDING_RESTORE && state !== exports.ISTATE_PENDING_IMPORT) return new BoxError(BoxError.BAD_STATE, 'Not allowed in error state');
@@ -2246,7 +2246,7 @@ async function repair(app, data, auditSource) {
assert.strictEqual(typeof auditSource, 'object');
const appId = app.id;
let errorState = (app.error && app.error.installationState) || exports.ISTATE_PENDING_CONFIGURE;
let errorState = (app.error && app.error.details?.installationState) || exports.ISTATE_PENDING_CONFIGURE;
const task = {
args: {},