-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.replIssues and PRs related to the REPL subsystem.Issues and PRs related to the REPL subsystem.
Description
- Version: 14.11.0
- Platform: macOS Catalina 10.15.6
I have also reproduced this in Node 12.18.4.
What steps will reproduce the bug?
Launch the repl with this command:
node --unhandled-rejections=strict
(--unhandled-rejections=throw
has the same issue.)
On the repl command line, type Promise.reject()
.
What is the expected behavior?
When an uncaught error is thrown in the repl, the repl should print "Uncaught error" without terminating the process. For example:
> throw new Error()
Uncaught Error
> void setTimeout(_=>{throw new Error()}, 0)
undefined
> Uncaught Error
What do you see instead?
The process crashes.
> Promise.reject()
Promise { <rejected> undefined }
> internal/process/promises.js:213
triggerUncaughtException(err, true /* fromPromise */);
^
[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 "undefined".] {
code: 'ERR_UNHANDLED_REJECTION'
}
Additional information
This bug will become more important in Node 15 when --unhandled-rejections=throw
becomes the default, per PR #33021. At that point, the bug will repro when launching node
using the default settings with no flags.
BridgeAR, mmarchini, benjamingr, ExE-Boss, codergautam and 3 more
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.replIssues and PRs related to the REPL subsystem.Issues and PRs related to the REPL subsystem.