-
-
Notifications
You must be signed in to change notification settings - Fork 34.7k
Closed
Labels
v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.
Description
- Version: 8.5.0, master (9.0.0 2017 09 12)
- Platform: Windows 7 x64
- Subsystem: errors
Compare these 3 async IIFEs and their error stacks (different code lines and corresponded stack position names are marked by // NB string):
'use strict';
function promiseFunc(arg) {
return new Promise(function promiseHandlers(resolve, reject) {
if (arg) resolve(`Got ${arg}`);
else reject(new Error(`Got ${arg}`));
});
}
(async function asyncFunc() { // NB
try {
const result = await promiseFunc(true);
console.log(`Result: ${result}`);
await promiseFunc(false);
console.log('This is not logged.');
} catch (err) {
console.error(err);
}
}());
(async function () { // NB
try {
const result = await promiseFunc(true);
console.log(`Result: ${result}`);
await promiseFunc(false);
console.log('This is not logged.');
} catch (err) {
console.error(err);
}
}());
(async () => { // NB
try {
const result = await promiseFunc(true);
console.log(`Result: ${result}`);
await promiseFunc(false);
console.log('This is not logged.');
} catch (err) {
console.error(err);
}
})();Result: Got true
Result: Got true
Result: Got true
Error: Got false
at promiseHandlers (e:\DOC\prg\js\node\-test\test.js:6:17)
at Promise (<anonymous>)
at promiseFunc (e:\DOC\prg\js\node\-test\test.js:4:10)
at asyncFunc (e:\DOC\prg\js\node\-test\test.js:15:11) // NB
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
at Function.Module.runMain (module.js:667:11)
at startup (bootstrap_node.js:201:16)
at bootstrap_node.js:626:3
Error: Got false
at promiseHandlers (e:\DOC\prg\js\node\-test\test.js:6:17)
at Promise (<anonymous>)
at promiseFunc (e:\DOC\prg\js\node\-test\test.js:4:10)
at e:\DOC\prg\js\node\-test\test.js:27:11 // NB
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
at Function.Module.runMain (module.js:667:11)
at startup (bootstrap_node.js:201:16)
at bootstrap_node.js:626:3
Error: Got false
at promiseHandlers (e:\DOC\prg\js\node\-test\test.js:6:17)
at Promise (<anonymous>)
at promiseFunc (e:\DOC\prg\js\node\-test\test.js:4:10)
at __dirname (e:\DOC\prg\js\node\-test\test.js:39:11) // NB
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
at Function.Module.runMain (module.js:667:11)
at startup (bootstrap_node.js:201:16)
at bootstrap_node.js:626:3Is __dirname position name in the last stack intended?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.