Skip to content

Commit

Permalink
doc: clarify uncaughtException origin for ESM
Browse files Browse the repository at this point in the history
Fixes: #41328

PR-URL: #41339
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
  • Loading branch information
aduh95 authored and targos committed Jan 14, 2022
1 parent 4a57d47 commit edc6a7a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 3 additions & 0 deletions doc/api/cli.md
Expand Up @@ -1261,6 +1261,9 @@ 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 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`

<!-- YAML
Expand Down
16 changes: 10 additions & 6 deletions doc/api/process.md
Expand Up @@ -335,9 +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.
`'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 @@ -431,9 +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.
`'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

0 comments on commit edc6a7a

Please sign in to comment.