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 return cp
} catch (e) { } catch (e) {
warn(`Error spawning: ${e}`) warn(`Error spawning: ${e}`)
userInstanceLogger.error(`Error spawning: ${e}`)
if (UPGRADE_MODE()) { if (UPGRADE_MODE()) {
throw new Error( // Noop
`PocketHost is rebooting. Try again in a few seconds.`,
)
} else { } else {
await updateInstance(instance.id, { await updateInstance(instance.id, {
maintenance: true, maintenance: true,
}) })
userInstanceLogger.error( }
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`, `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`)
}
} }
})() })()
const { pid: _pid, exitCode } = childProcess const { pid: _pid, exitCode } = childProcess