mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
lib: fix validateport error message when allowZero is false
PR-URL: https://github.com/nodejs/node/pull/32861 Fixes: https://github.com/nodejs/node/issues/32857 Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
aa9708e479
commit
1d0b24924f
3 changed files with 8 additions and 4 deletions
|
@ -190,7 +190,7 @@ function validatePort(port, name = 'Port', { allowZero = true } = {}) {
|
|||
+port !== (+port >>> 0) ||
|
||||
port > 0xFFFF ||
|
||||
(port === 0 && !allowZero)) {
|
||||
throw new ERR_SOCKET_BAD_PORT(name, port);
|
||||
throw new ERR_SOCKET_BAD_PORT(name, port, allowZero);
|
||||
}
|
||||
return port | 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue