Updating logging for app migration.

This commit is contained in:
mike12345567 2024-06-07 18:31:40 +01:00
parent 17e62586c9
commit 67c6c156e3
1 changed files with 10 additions and 8 deletions

View File

@ -20,8 +20,8 @@ export async function processMigrations(
resource: appId,
},
async () => {
try {
await context.doInAppMigrationContext(appId, async () => {
await context.doInAppMigrationContext(appId, async () => {
try {
let currentVersion = await getAppMigrationVersion(appId)
const pendingMigrations = migrations
@ -36,7 +36,9 @@ export async function processMigrations(
migrationIds[migrationIds.indexOf(currentVersion) + 1]
if (expectedMigration !== id) {
throw `Migration ${id} could not run, update for "${id}" is running but ${expectedMigration} is expected`
throw new Error(
`Migration ${id} could not run, update for "${id}" is running but ${expectedMigration} is expected`
)
}
const counter = `(${++index}/${pendingMigrations.length})`
@ -51,11 +53,11 @@ export async function processMigrations(
})
currentVersion = id
}
})
} catch (err) {
logging.logAlert("Failed to run app migration", err)
throw err
}
} catch (err) {
logging.logAlert("Failed to run app migration", err)
throw err
}
})
}
)