mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
fix: error handling of container failures
This commit is contained in:
1 parent
3fdbca89f3
commit
8b5f7175a7
2 files changed
+64
-67
No files matched your search
@@ -35,16 +35,11 @@ export async function createContainer(name) {
|
||||
|
||||
export async function getAndStartContainer(id) {
|
||||
console.log(`Getting container: ${id}`)
|
||||
let container
|
||||
try {
|
||||
container = engine.getContainer(id)
|
||||
if (!(await container.inspect()).State.Running) {
|
||||
await container.start()
|
||||
}
|
||||
return container
|
||||
} catch (error) {
|
||||
throw new Error(`Container not found: ${id}`)
|
||||
const container = engine.getContainer(id)
|
||||
if (!(await container.inspect()).State.Running) {
|
||||
await container.start()
|
||||
}
|
||||
return container
|
||||
}
|
||||
|
||||
export async function attachContainer(container, { token }) {
|
||||
|
||||
Reference in new issue
Block a user