fix(doctor): catch unexpected failures and provide actionable diagnostics (fixes #3345)

This commit is contained in:
MoerAI
2026-04-24 11:13:38 +09:00
committed by YeonGyu-Kim
parent 7ac1109611
commit 2971322952
+11 -2
View File
@@ -1,9 +1,18 @@
import type { DoctorOptions } from "./types"
import { runDoctor } from "./runner"
import { EXIT_CODES } from "./constants"
export async function doctor(options: DoctorOptions = { mode: "default" }): Promise<number> {
const result = await runDoctor(options)
return result.exitCode
try {
const result = await runDoctor(options)
return result.exitCode
} catch (error) {
const message = error instanceof Error ? error.message : String(error)
console.error("\nDoctor failed unexpectedly:", message)
console.error("This may indicate memory pressure (OOM/SIGKILL) or a corrupted installation.")
console.error("Try: OMO_DISABLE_POSTHOG=1 bunx oh-my-opencode doctor --verbose\n")
return EXIT_CODES.FAILURE
}
}
export * from "./types"