-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Outdated: unhandled promise rejections no longer disappear silently since Node.js 15 #1360
Description
File: sections/errorhandling/catchunhandledpromiserejection.md
What the article currently says
The One Paragraph Explainer states:
"unless a developer remembered to add a .catch clause, errors thrown at these places are not handled by the uncaughtException event-handler and disappear"
"Recent versions of Node added a warning message when an unhandled rejection pops, though this might help to notice when things go wrong but it's obviously not a proper error handling method"
The Blog Quote section also reinforces this:
"the reality is that a number of modern JavaScript environments won't print errors for any of them"
What has changed
Since Node.js 15, unhandled promise rejections crash the process by default (exit code 1). They no longer disappear silently.
This was introduced via PR #33021 — a semver-major change that resolved the long-standing DEP0018 deprecation (the same deprecation warning the article dismisses as "not a proper error handling method"). The exact commit is 3b10f7f.
Timeline:
- Node 6.6 → prints a
DEP0018deprecation warning, but keeps running (exit code 0) - Node 15+ → crashes the process with a full stack trace (exit code 1) ← current default
Reproducible example — on Node 15+ this crashes, it does not silently finish:
async function fetchData() {
throw new Error('something went wrong');
}
fetchData(); // no await, no .catch
console.log('script finished');Output on Node 15+:
script finished
/home/user/test.js:2
throw new Error('something went wrong');
^
Error: something went wrong
at fetchData (/home/user/test.js:2:9)
...
The old silent behavior can be restored with --unhandled-rejections=none.
Suggested update
- Update the One Paragraph Explainer to clarify the "disappear silently" behavior only applies to Node < 15
- Note that
process.on('unhandledRejection')is still valuable for custom handling (structured logging, graceful shutdown, alerting) — but it's no longer the only thing preventing silent failures on modern Node - Add a Node version compatibility note near the top of the section
- The Blog Quote from James Nelson may also need a caveat since it was written when silent failures were the norm