Skip to content

Commit 9912843

Browse files
committed
errors: backport ERR_INVALID_PROTOCOL to v8.x
This error code originally landed in a semver-major commit and is used by the ESM implementation. This backport includes the error message and the documentation for the error. I did attempt to write a test for this, but it did not seem possible to catch an exception during import, I was also unable to execute `node --experimental-modules` properly inside of a child_process. I'll dig more into getting a test together, but we should backport this fix in the mean time. Refs: #14423 Fixes: #15374
1 parent 99dc1f9 commit 9912843

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

doc/api/errors.md

+5
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,11 @@ communication channel to a child process. See [`subprocess.send()`] and
835835
Used generically to identify when an invalid or unexpected value has been
836836
passed in an options object.
837837

838+
<a id="ERR_INVALID_PROTOCOL"></a>
839+
### ERR_INVALID_PROTOCOL
840+
841+
Used when an invalid `options.protocol` is passed.
842+
838843
<a id="ERR_INVALID_SYNC_FORK_INPUT"></a>
839844
### ERR_INVALID_SYNC_FORK_INPUT
840845

lib/internal/errors.js

+2
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ E('ERR_INVALID_OPT_VALUE',
196196
return `The value "${String(value)}" is invalid for option "${name}"`;
197197
});
198198
E('ERR_INVALID_PERFORMANCE_MARK', 'The "%s" performance mark has not been set');
199+
E('ERR_INVALID_PROTOCOL', (protocol, expectedProtocol) =>
200+
`Protocol "${protocol}" not supported. Expected "${expectedProtocol}"`);
199201
E('ERR_INVALID_SYNC_FORK_INPUT',
200202
(value) => {
201203
return 'Asynchronous forks do not support Buffer, Uint8Array or string' +

0 commit comments

Comments
 (0)