Skip to content

Commit

Permalink
errors: backport ERR_INVALID_PROTOCOL to v8.x
Browse files Browse the repository at this point in the history
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

PR-URL: #15388
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
MylesBorins committed Sep 14, 2017
1 parent 99dc1f9 commit da3265a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions doc/api/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,11 @@ communication channel to a child process. See [`subprocess.send()`] and
Used generically to identify when an invalid or unexpected value has been
passed in an options object.

<a id="ERR_INVALID_PROTOCOL"></a>
### ERR_INVALID_PROTOCOL

Used when an invalid `options.protocol` is passed.

<a id="ERR_INVALID_SYNC_FORK_INPUT"></a>
### ERR_INVALID_SYNC_FORK_INPUT

Expand Down
2 changes: 2 additions & 0 deletions lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ E('ERR_INVALID_OPT_VALUE',
return `The value "${String(value)}" is invalid for option "${name}"`;
});
E('ERR_INVALID_PERFORMANCE_MARK', 'The "%s" performance mark has not been set');
E('ERR_INVALID_PROTOCOL', (protocol, expectedProtocol) =>
`Protocol "${protocol}" not supported. Expected "${expectedProtocol}"`);
E('ERR_INVALID_SYNC_FORK_INPUT',
(value) => {
return 'Asynchronous forks do not support Buffer, Uint8Array or string' +
Expand Down

0 comments on commit da3265a

Please sign in to comment.