bun with oclif not catching unhandled exceptions
codegod100 opened this issue Β· comments
Describe the bug
while using bun oclif doesn't catch unhandled exceptions
To Reproduce
Steps to reproduce the behavior:
- change shebang to #!/usr/bin/env bun
- throw unhandled exception
- no error output
Expected behavior
stack trace of exception
Environment (please complete the following information):
- OS & version: debian 12
- Shell/terminal & version: vscode
@codegod100 Can you create a repository that replicates the issue? Thanks
Good news: I get the same result regardless of whether I use bun or node.
Bad news: the result doesn't include the stacktrace.
Replication steps:
- follow tutorial with Node LTS
- add
throw new Error("testing");
torun
in src/commands/hello/world.ts npm run build
/bin/run.js hello world
But maybe the lack of stacktrace is intentional? Not sure. I tried setting DEBUG=*
(see https://oclif.io/docs/debugging) but nothing changed when I ran it again
@calebAtIspot I followed your steps and I see the stacktrace in the debug output:
Error: testing
oclif:error Error: testing
oclif:error at <anonymous> (~/code/gh1086/src/commands/hello/world.ts:16:29)
oclif:error at run (~/code/gh1086/src/commands/hello/world.ts:14:15)
oclif:error at <anonymous> (~/code/gh1086/node_modules/@oclif/core/lib/command.js:228:32)
oclif:error at processTicksAndRejections (:12:39) +0ms
These are the steps I followed:
node version: 20.31.1
bun version: 1.1.12
oclif version: 4.13.5
oclif generate gh1086 --yes
- change shebang in
bin/run.js
to#!/usr/bin/env bun
- add
throw new Error("testing");
torun
insrc/commands/hello/world.ts
npm run build
DEBUG=* bin/run.js hello world
What am I missing?
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.