1
0
Fork 0
mirror of synced 2024-09-09 22:16:26 +12:00

Updating logging for app migration.

This commit is contained in:
mike12345567 2024-06-07 18:31:40 +01:00
parent 17e62586c9
commit 67c6c156e3

View file

@ -20,8 +20,8 @@ export async function processMigrations(
resource: appId, resource: appId,
}, },
async () => { async () => {
try { await context.doInAppMigrationContext(appId, async () => {
await context.doInAppMigrationContext(appId, async () => { try {
let currentVersion = await getAppMigrationVersion(appId) let currentVersion = await getAppMigrationVersion(appId)
const pendingMigrations = migrations const pendingMigrations = migrations
@ -36,7 +36,9 @@ export async function processMigrations(
migrationIds[migrationIds.indexOf(currentVersion) + 1] migrationIds[migrationIds.indexOf(currentVersion) + 1]
if (expectedMigration !== id) { 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})` const counter = `(${++index}/${pendingMigrations.length})`
@ -51,11 +53,11 @@ export async function processMigrations(
}) })
currentVersion = id currentVersion = id
} }
}) } catch (err) {
} catch (err) { logging.logAlert("Failed to run app migration", err)
logging.logAlert("Failed to run app migration", err) throw err
throw err }
} })
} }
) )