-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Confusing error message when a non-Error value is thrown during require() #35687
Labels
esm
Issues and PRs related to the ECMAScript Modules implementation.
Comments
targos
added a commit
to targos/node
that referenced
this issue
Oct 17, 2020
It is guaranteed that V8 throws a syntax error when `import` or `export` is used outside of ESM. Fixes: nodejs#35687
3 tasks
MylesBorins
pushed a commit
that referenced
this issue
Nov 3, 2020
It is guaranteed that V8 throws a syntax error when `import` or `export` is used outside of ESM. Fixes: #35687 PR-URL: #35691 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Guy Bedford <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
BethGriggs
pushed a commit
that referenced
this issue
Dec 8, 2020
It is guaranteed that V8 throws a syntax error when `import` or `export` is used outside of ESM. Fixes: #35687 PR-URL: #35691 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Guy Bedford <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
BethGriggs
pushed a commit
that referenced
this issue
Dec 10, 2020
It is guaranteed that V8 throws a syntax error when `import` or `export` is used outside of ESM. Fixes: #35687 PR-URL: #35691 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Guy Bedford <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
BethGriggs
pushed a commit
that referenced
this issue
Dec 15, 2020
It is guaranteed that V8 throws a syntax error when `import` or `export` is used outside of ESM. Fixes: #35687 PR-URL: #35691 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Guy Bedford <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What steps will reproduce the bug?
The problem can be reproduced with these three files:
Run this with
node --experimental-modules index.mjs
.What is the expected behavior?
I expected to see something like this, which is what I see when I run
node cjs-file.cjs
:What do you see instead?
I see this:
This error message is a) super confusing and b) masks the original error.
Additional information
It looks to me like the
enrichCJSError
function either shouldn't be assuming that the error is an object with astack
property, or the caller should be checking for something likeinstanceof Error
first.The text was updated successfully, but these errors were encountered: