Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errors with --experimental-loader trigger unhandled rejections in core #30205

Closed
targos opened this issue Nov 1, 2019 · 2 comments
Closed

errors with --experimental-loader trigger unhandled rejections in core #30205

targos opened this issue Nov 1, 2019 · 2 comments
Labels
confirmed-bug Issues with confirmed bugs. esm Issues and PRs related to the ECMAScript Modules implementation.

Comments

@targos
Copy link
Member

targos commented Nov 1, 2019

$ node --experimental-modules --experimental-loader i-dont-exist test.mjs
(node:480349) ExperimentalWarning: The ESM module loader is experimental.
(node:480349) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(node:480349) UnhandledPromiseRejectionWarning: Error: Cannot find package 'i-dont-exist' imported from /home/mzasso/test/m/
    at Loader.resolve [as _resolve] (internal/modules/esm/default_resolve.js:84:13)
    at Loader.resolve (internal/modules/esm/loader.js:74:33)
    at Loader.getModuleJob (internal/modules/esm/loader.js:148:40)
    at Loader.import (internal/modules/esm/loader.js:132:28)
    at internal/process/esm_loader.js:60:31
    at Object.initializeLoader (internal/process/esm_loader.js:64:5)
    at runMainESM (internal/bootstrap/pre_execution.js:480:20)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1049:5)
    at internal/main/run_main_module.js:16:11
(node:480349) UnhandledPromiseRejectionWarning: Unhandled promise rejection. 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(). (rejection id: 2)
(node:480349) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
$ node --experimental-modules --experimental-loader ./i-have-syntax-error.mjs test.mjs
(node:480438) ExperimentalWarning: The ESM module loader is experimental.
(node:480438) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(node:480438) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected end of input
    at Loader.moduleStrategy (internal/modules/esm/translators.js:84:18)
    at async link (internal/modules/esm/module_job.js:36:21)
(node:480438) UnhandledPromiseRejectionWarning: Unhandled promise rejection. 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(). (rejection id: 1)
(node:480438) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@targos targos added confirmed-bug Issues with confirmed bugs. esm Issues and PRs related to the ECMAScript Modules implementation. labels Nov 1, 2019
@guybedford
Copy link
Contributor

Great to see these, thanks.

It seems like the issue is that the promise catch handler at https://github.com/nodejs/node/blob/master/lib/internal/bootstrap/pre_execution.js#L484 should be moved up one level to also be able to catch the initializeLoader errors the same way.

targos added a commit to targos/node that referenced this issue Nov 2, 2019
Previously, this would trigger an unhandled rejection that the user
cannot handle.

Fixes: nodejs#30205
@targos
Copy link
Member Author

targos commented Nov 2, 2019

Fix: #30219

@targos targos closed this as completed in 8bb83f4 Nov 9, 2019
MylesBorins pushed a commit that referenced this issue Nov 17, 2019
Previously, this would trigger an unhandled rejection that the user
cannot handle.

Fixes: #30205

PR-URL: #30219
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
MylesBorins pushed a commit that referenced this issue Jan 12, 2020
Previously, this would trigger an unhandled rejection that the user
cannot handle.

Fixes: #30205

PR-URL: #30219
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
BethGriggs pushed a commit that referenced this issue Feb 6, 2020
Previously, this would trigger an unhandled rejection that the user
cannot handle.

Fixes: #30205

PR-URL: #30219
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. esm Issues and PRs related to the ECMAScript Modules implementation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants