Skip to content

Commit 1f380d1

Browse files
fixup: switch back to regular value arg to error
1 parent c516dcd commit 1f380d1

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

lib/internal/modules/esm/loader.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ const { getOptionValue } = require('internal/options');
9494

9595
let emittedSpecifierResolutionWarning = false;
9696

97-
const nullTypeForErr = { constructor: { name: 'null' } };
98-
9997
/**
10098
* A utility function to iterate through a hook chain, track advancement in the
10199
* chain, and generate and supply the `next<HookName>` argument to the custom
@@ -608,7 +606,7 @@ class ESMLoader {
608606
throw new ERR_INVALID_RETURN_VALUE(
609607
'an object',
610608
hookErrIdentifier,
611-
output === null ? nullTypeForErr : output,
609+
output,
612610
);
613611
}
614612
};
@@ -844,7 +842,7 @@ class ESMLoader {
844842
throw new ERR_INVALID_RETURN_VALUE(
845843
'an object',
846844
hookErrIdentifier,
847-
output === null ? nullTypeForErr : output,
845+
output,
848846
);
849847
}
850848
};

test/es-module/test-esm-loader-chaining.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ const commonArgs = [
332332
assert.match(stderr, /loader-resolve-null-return\.mjs/);
333333
assert.match(stderr, /'resolve' hook's nextResolve\(\)/);
334334
assert.match(stderr, /an object/);
335-
assert.match(stderr, /instance of null/);
335+
assert.match(stderr, /got null/);
336336
}
337337

338338
{ // Verify error thrown when invalid `context` argument passed to `nextResolve`
@@ -372,7 +372,7 @@ const commonArgs = [
372372
assert.match(stderr, /loader-load-null-return\.mjs/);
373373
assert.match(stderr, /'load' hook's nextLoad\(\)/);
374374
assert.match(stderr, /an object/);
375-
assert.match(stderr, /instance of null/);
375+
assert.match(stderr, /got null/);
376376
}
377377

378378
{ // Verify error thrown when invalid `url` argument passed to `nextLoad`

0 commit comments

Comments
 (0)