GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — loader: remove unused error code in module_job · nodejs/node@653b20b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/modules/esm
    • module_job.js
  • test/es-module
    • test-esm-error-cache.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/modules/esm/module_job.js‎

Copy file name to clipboardExpand all lines: lib/internal/modules/esm/module_job.js
+2-18Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ class ModuleJob {
1414
// `moduleProvider` is a function
1515
constructor(loader, url, moduleProvider, isMain) {
1616
this.loader = loader;
17-
this.error = null;
18-
this.hadError = false;
1917
this.isMain = isMain;
2018

2119
// This is a Promise<{ module, reflect }>, whose fields will be copied
@@ -72,15 +70,7 @@ class ModuleJob {
7270
const dependencyJobs = await moduleJob.linked;
7371
return Promise.all(dependencyJobs.map(addJobsToDependencyGraph));
7472
};
75-
try {
76-
await addJobsToDependencyGraph(this);
77-
} catch (e) {
78-
if (!this.hadError) {
79-
this.error = e;
80-
this.hadError = true;
81-
}
82-
throw e;
83-
}
73+
await addJobsToDependencyGraph(this);
8474
try {
8575
if (this.isMain && process._breakFirstLine) {
8676
delete process._breakFirstLine;
@@ -103,13 +93,7 @@ class ModuleJob {
10393

10494
async run() {
10595
const module = await this.instantiate();
106-
try {
107-
module.evaluate(-1, false);
108-
} catch (e) {
109-
this.hadError = true;
110-
this.error = e;
111-
throw e;
112-
}
96+
module.evaluate(-1, false);
11397
return module;
11498
}
11599
}
Collapse file

‎test/es-module/test-esm-error-cache.js‎

Copy file name to clipboard
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
'use strict';
2+
3+
// Flags: --experimental-modules
4+
5+
const common = require('../common');
6+
const assert = require('assert');
7+
8+
common.crashOnUnhandledRejection();
9+
10+
const file = '../../fixtures/syntax/bad_syntax.js';
11+
12+
let error;
13+
(async () => {
14+
try {
15+
await import(file);
16+
} catch (e) {
17+
assert.strictEqual(e.name, 'SyntaxError');
18+
error = e;
19+
}
20+
21+
assert(error);
22+
23+
try {
24+
await import(file);
25+
} catch (e) {
26+
assert.strictEqual(error, e);
27+
}
28+
})();

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.