Skip to content

Commit bd6bb89

Browse files
committed
errors: fix ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK
This restores a broken and erroneously removed error, which was accidentially renamed to ERR_MISSING_DYNAMIC_INTSTANTIATE_HOOK (notice the "INTST" vs "INST") in 921fb84 (PR #16874) and then had documentation and implementation removed under the old name in 6e1c25c (PR #18857), as it appeared unused. This error code never worked or was documented under the mistyped name ERR_MISSING_DYNAMIC_INTSTANTIATE_HOOK, so renaming it back to ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK is a semver-patch fix. Refs: #21440 Refs: #21470 Refs: #16874 Refs: #18857
1 parent a40e062 commit bd6bb89

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

doc/api/errors.md

+8
Original file line numberDiff line numberDiff line change
@@ -1312,6 +1312,14 @@ strict compliance with the API specification (which in some cases may accept
13121312
`func(undefined)` and `func()` are treated identically, and the
13131313
[`ERR_INVALID_ARG_TYPE`][] error code may be used instead.
13141314

1315+
<a id="ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK"></a>
1316+
### ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK
1317+
1318+
> Stability: 1 - Experimental
1319+
1320+
An [ES6 module][] loader hook specified `format: 'dynamic` but did not provide a
1321+
`dynamicInstantiate` hook.
1322+
13151323
<a id="ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST"></a>
13161324
### ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST
13171325

lib/internal/errors.js

+3
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,9 @@ E('ERR_MISSING_ARGS',
725725
}
726726
return `${msg} must be specified`;
727727
}, TypeError);
728+
E('ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK',
729+
'The ES Module loader may not return a format of \'dynamic\' when no ' +
730+
'dynamicInstantiate function was provided');
728731
E('ERR_MISSING_MODULE', 'Cannot find module %s', Error);
729732
E('ERR_MODULE_RESOLUTION_LEGACY',
730733
'%s not found by import in %s.' +

lib/internal/modules/esm/loader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class Loader {
9393
let loaderInstance;
9494
if (format === 'dynamic') {
9595
if (typeof this._dynamicInstantiate !== 'function')
96-
throw new ERR_MISSING_DYNAMIC_INTSTANTIATE_HOOK();
96+
throw new ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK();
9797

9898
loaderInstance = async (url) => {
9999
debug(`Translating dynamic ${url}`);

0 commit comments

Comments
 (0)