Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! doc: clarify uncaughtException origin for ESM
  • Loading branch information
aduh95 committed Dec 28, 2021
commit b589d69ae12541c4b31db041fef837c50d86a893
4 changes: 2 additions & 2 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -1262,8 +1262,8 @@ occurs. One of the following modes can be chosen:
set, trigger a warning, and set the process exit code to 1.
* `none`: Silence all warnings.

If a rejection happens during the ES module static loading phase, it will always
raise it as an uncaught exception.
If a rejection happens during the command line entry point's ES module static
loading phase, it will always raise it as an uncaught exception.

### `--use-bundled-ca`, `--use-openssl-ca`

Expand Down
20 changes: 10 additions & 10 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,11 @@ changes:
* `err` {Error} The uncaught exception.
* `origin` {string} Indicates if the exception originates from an unhandled
rejection or from an synchronous error. Can either be `'uncaughtException'` or
`'unhandledRejection'`. The latter is only used in conjunction with the
[`--unhandled-rejections`][] flag set to `strict` or `throw` and
an unhandled rejection, or when a rejection happens during the ES module
static loading phase.
`'unhandledRejection'`. The latter is used when in an exception happens in a
`Promise` based async context (or if a `Promise` is rejected) and
[`--unhandled-rejections`][] flag set to `strict` or `throw` (which is the
default) and the rejection is not handled, or when a rejection happens during
the command line entry point's ES module static loading phase.

The `'uncaughtException'` event is emitted when an uncaught JavaScript
exception bubbles all the way back to the event loop. By default, Node.js
Expand Down Expand Up @@ -366,8 +367,6 @@ setTimeout(() => {
}, 500);

// Intentionally cause an exception, but don't catch it.
// Because the exception happens when evaluating an ES module, this is
// undistinguishable from a Promise rejection, and will be reported as such.
nonexistentFunc();
console.log('This will not run.');
```
Expand Down Expand Up @@ -434,10 +433,11 @@ added:
* `err` {Error} The uncaught exception.
* `origin` {string} Indicates if the exception originates from an unhandled
rejection or from synchronous errors. Can either be `'uncaughtException'` or
`'unhandledRejection'`. The latter is only used in conjunction with the
[`--unhandled-rejections`][] flag set to `strict` or `throw` and
an unhandled rejection, or when a rejection happens during the ES module
static loading phase.
`'unhandledRejection'`. The latter is used when in an exception happens in a
`Promise` based async context (or if a `Promise` is rejected) and
[`--unhandled-rejections`][] flag set to `strict` or `throw` (which is the
default) and the rejection is not handled, or when a rejection happens during
the command line entry point's ES module static loading phase.

The `'uncaughtExceptionMonitor'` event is emitted before an
`'uncaughtException'` event is emitted or a hook installed via
Expand Down