-
-
Notifications
You must be signed in to change notification settings - Fork 32k
module: fix e.stack
error when throwing undefined or null
#19282
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
Changes from all commits
1f2a241
4b73eb6
0b3bd33
8e3cb79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Flags: --experimental-modules | ||
/* eslint-disable node-core/required-modules */ | ||
import common from '../common/index.js'; | ||
import assert from 'assert'; | ||
|
||
async function doTest() { | ||
await assert.rejects( | ||
async () => { | ||
await import('../fixtures/es-module-loaders/throw-undefined'); | ||
}, | ||
(e) => e === undefined | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: await assert.rejects(
import('../fixtures/es-module-loaders/throw-undefined'),
(e) => e === undefined); The extra arrow function doesn't seem needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just followed the example here: You mean, the first parameter can be a promise (not a function)? I don't know, but I think mine is more formal :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh oops, never mind that. |
||
} | ||
|
||
common.crashOnUnhandledRejection(); | ||
doTest(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
'use strict'; | ||
|
||
throw undefined; |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add a
common.crashOnUnhandledRejection();
line here, and remove the.then(common.mustCall())
later.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TimothyGu Thank you. As this is the first time I make a pull request I'm not very familiar with the these functions. You can add it later :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TimothyGu I added.