mirror of
https://github.com/sst/opencode.git
synced 2025-08-30 17:57:25 +00:00
redirect uncaught errors to log file
This commit is contained in:
parent
9acc83697f
commit
4dbc6a43a6
1 changed files with 12 additions and 0 deletions
|
@ -26,6 +26,18 @@ import { ServeCommand } from "./cli/cmd/serve"
|
||||||
|
|
||||||
const cancel = new AbortController()
|
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))
|
const cli = yargs(hideBin(process.argv))
|
||||||
.scriptName("opencode")
|
.scriptName("opencode")
|
||||||
.help("help", "show help")
|
.help("help", "show help")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue