Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/internal/modules/esm/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const {
ObjectDefineProperty,
ObjectSetPrototypeOf,
PromiseAll,
PromisePrototypeCatch,
RegExpPrototypeExec,
SafeArrayIterator,
SafeWeakMap,
Expand Down Expand Up @@ -525,9 +526,12 @@ class ESMLoader {
.then(({ module }) => module.getNamespace());
}

const namespaces = await PromiseAll(new SafeArrayIterator(jobs));
const namespaces = await PromisePrototypeCatch(
PromiseAll(new SafeArrayIterator(jobs)),
(err) => { throw err; }, // Make errors catchable in a custom loader.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the default catch handler - I’m not sure why this has any effect?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I'm confused: it wasn't working before this, I add it, it's working, I remove it, it's still working.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's probably something else that changed on your end, this change should have no effect on the catchability of errors.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird. I can't explain it

);

if (!wasArr) { return namespaces[0]; } // We can skip the pairing below
if (!wasArr) { return namespaces[0]; } // We can skip the pairing below.

for (let i = 0; i < count; i++) {
const namespace = ObjectCreate(null);
Expand Down