Skip to content

Commit 5e4e4e0

Browse files
committed
fix(opencode): add comprehensive error handling to oclite entry (#128)
- Add process.on('unhandledRejection') handler - Add process.on('uncaughtException') handler - Add main().catch() for fatal errors - All errors logged via Log.Default.error() or console.error Improves error visibility and graceful failure for #128
1 parent 24159ee commit 5e4e4e0

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

‎packages/opencode/src/cli/ink/entry.ts‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ async function main() {
1515
level: "INFO",
1616
})
1717

18+
process.on("unhandledRejection", (e) => {
19+
Log.Default.error("rejection", {
20+
e: e instanceof Error ? e.message : e,
21+
})
22+
})
23+
24+
process.on("uncaughtException", (e) => {
25+
Log.Default.error("exception", {
26+
e: e instanceof Error ? e.message : e,
27+
})
28+
})
29+
1830
await Instance.provide({
1931
directory: process.cwd(),
2032
init: InstanceBootstrap,
@@ -28,4 +40,7 @@ async function main() {
2840
}
2941
}
3042

31-
main()
43+
main().catch((error) => {
44+
console.error("Fatal error:", error)
45+
process.exit(1)
46+
})

0 commit comments

Comments
 (0)