errors: fix ERR_SOCKET_BAD_PORT message
The current message says 'Port should be > 0' meaning '0' is an invalid value. You can pass '0' to get a random port from the system. The correct message for this error is 'Port should be >= 0'. PR-URL: https://github.com/nodejs/node/pull/23015 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
parent
0227635315
commit
4e084addcd
@ -1521,7 +1521,7 @@ An invalid (negative) size was passed for either the `recvBufferSize` or
|
||||
<a id="ERR_SOCKET_BAD_PORT"></a>
|
||||
### ERR_SOCKET_BAD_PORT
|
||||
|
||||
An API function expecting a port > 0 and < 65536 received an invalid value.
|
||||
An API function expecting a port >= 0 and < 65536 received an invalid value.
|
||||
|
||||
<a id="ERR_SOCKET_BAD_TYPE"></a>
|
||||
### ERR_SOCKET_BAD_TYPE
|
||||
|
@ -801,7 +801,7 @@ E('ERR_SOCKET_ALREADY_BOUND', 'Socket is already bound', Error);
|
||||
E('ERR_SOCKET_BAD_BUFFER_SIZE',
|
||||
'Buffer size must be a positive integer', TypeError);
|
||||
E('ERR_SOCKET_BAD_PORT',
|
||||
'Port should be > 0 and < 65536. Received %s.', RangeError);
|
||||
'Port should be >= 0 and < 65536. Received %s.', RangeError);
|
||||
E('ERR_SOCKET_BAD_TYPE',
|
||||
'Bad socket type specified. Valid types are: udp4, udp6', TypeError);
|
||||
E('ERR_SOCKET_BUFFER_SIZE',
|
||||
|
@ -290,7 +290,7 @@ const portErr = (port) => {
|
||||
const err = {
|
||||
code: 'ERR_SOCKET_BAD_PORT',
|
||||
message:
|
||||
`Port should be > 0 and < 65536. Received ${port}.`,
|
||||
`Port should be >= 0 and < 65536. Received ${port}.`,
|
||||
type: RangeError
|
||||
};
|
||||
|
||||
|
@ -129,7 +129,7 @@ assert.strictEqual(errors.getMessage('ERR_MISSING_ARGS', ['a', 'b', 'c']),
|
||||
// Test ERR_SOCKET_BAD_PORT
|
||||
assert.strictEqual(
|
||||
errors.getMessage('ERR_SOCKET_BAD_PORT', [0]),
|
||||
'Port should be > 0 and < 65536. Received 0.');
|
||||
'Port should be >= 0 and < 65536. Received 0.');
|
||||
|
||||
// Test ERR_TLS_CERT_ALTNAME_INVALID
|
||||
assert.strictEqual(
|
||||
|
Loading…
x
Reference in New Issue
Block a user