redirect uncaught errors to log file

This commit is contained in:
Dax Raad 2025-06-25 08:41:10 -04:00 committed by Jay V
parent 9acc83697f
commit 4dbc6a43a6

View file

@ -26,6 +26,18 @@ import { ServeCommand } from "./cli/cmd/serve"
const cancel = new AbortController()
process.on("unhandledRejection", (e) => {
Log.Default.error("rejection", {
e: e instanceof Error ? e.message : e,
})
})
process.on("uncaughtException", (e) => {
Log.Default.error("exception", {
e: e instanceof Error ? e.message : e,
})
})
const cli = yargs(hideBin(process.argv))
.scriptName("opencode")
.help("help", "show help")