chore: rework error messaging on container fail

This commit is contained in:
Ben Allfree 2024-01-24 21:36:27 +00:00
parent 752b0bcf78
commit 197b2f5370

View File

@ -301,19 +301,17 @@ export const instanceService = mkSingleton(
return cp
} catch (e) {
warn(`Error spawning: ${e}`)
userInstanceLogger.error(`Error spawning: ${e}`)
if (UPGRADE_MODE()) {
throw new Error(
`PocketHost is rebooting. Try again in a few seconds.`,
)
// Noop
} else {
await updateInstance(instance.id, {
maintenance: true,
})
userInstanceLogger.error(
`Could not launch container. Instance has been placed in maintenance mode. Please review your instance logs at https://app.pockethost.io/app/instances/${instance.id} or contact support at https://pockethost.io/support`,
)
throw new Error(`Maintenance mode`)
}
throw new Error(
`Could not launch container. Instance has been placed in maintenance mode. Please review your instance logs at https://app.pockethost.io/app/instances/${instance.id} or contact support at https://pockethost.io/support`,
)
}
})()
const { pid: _pid, exitCode } = childProcess