Skip to content

Commit

Permalink
fixup: switch back to regular value arg to error
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobJingleheimer committed Jun 24, 2022
1 parent c516dcd commit 1f380d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions lib/internal/modules/esm/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ const { getOptionValue } = require('internal/options');

let emittedSpecifierResolutionWarning = false;

const nullTypeForErr = { constructor: { name: 'null' } };

/**
* A utility function to iterate through a hook chain, track advancement in the
* chain, and generate and supply the `next<HookName>` argument to the custom
Expand Down Expand Up @@ -608,7 +606,7 @@ class ESMLoader {
throw new ERR_INVALID_RETURN_VALUE(
'an object',
hookErrIdentifier,
output === null ? nullTypeForErr : output,
output,
);
}
};
Expand Down Expand Up @@ -844,7 +842,7 @@ class ESMLoader {
throw new ERR_INVALID_RETURN_VALUE(
'an object',
hookErrIdentifier,
output === null ? nullTypeForErr : output,
output,
);
}
};
Expand Down
4 changes: 2 additions & 2 deletions test/es-module/test-esm-loader-chaining.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ const commonArgs = [
assert.match(stderr, /loader-resolve-null-return\.mjs/);
assert.match(stderr, /'resolve' hook's nextResolve\(\)/);
assert.match(stderr, /an object/);
assert.match(stderr, /instance of null/);
assert.match(stderr, /got null/);
}

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

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

0 comments on commit 1f380d1

Please sign in to comment.