fix(node-core): rejection warning in strict mode#21160
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 03a493d. Configure here.
03a493d to
5702627
Compare
f7b4f95 to
8a24c8b
Compare
isaacs
left a comment
There was a problem hiding this comment.
I'm a bit confused. I don't think that this actually does match the behavior in Node...?
$ node --unhandled-rejections=strict -e 'Promise.reject("ok")'
node:internal/process/promises:281
reason : new UnhandledPromiseRejection(reason);
^
UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "ok".
at strictUnhandledRejectionsMode (node:internal/process/promises:281:14)
at processPromiseRejections (node:internal/process/promises:413:17)
at process.processTicksAndRejections (node:internal/process/task_queues:105:32) {
code: 'ERR_UNHANDLED_REJECTION'
}
Node.js v26.0.0
Maybe I'm missing the intention. What is the situation that this is supposed to address?
|
@isaacs Okay, I don't think I've ever thrown a string as an error, but it seems the behavior is different in Node.js for Error objects vs strings: If it matters, I can adjust the PR to keep the current behavior if the object doesn't have a |
Only print it if the reason doesn't have a stack. This matches the behavior of Node.js.
8a24c8b to
e352e1e
Compare

Only print it if the reason doesn't have a stack. This matches the behavior of Node.js.
Before submitting a pull request, please take a look at our
Contributing guidelines and verify:
yarn lint) & (yarn test).