diff options
Diffstat (limited to 'lib/net.js')
-rw-r--r-- | lib/net.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/net.js b/lib/net.js index 121757aa10..5f4eec89ec 100644 --- a/lib/net.js +++ b/lib/net.js @@ -1005,19 +1005,23 @@ function lookupAndConnect(self, options) { var localAddress = options.localAddress; var localPort = options.localPort; - if (localAddress && !cares.isIP(localAddress)) + if (localAddress && !cares.isIP(localAddress)) { throw new TypeError('"localAddress" option must be a valid IP: ' + localAddress); + } - if (localPort && typeof localPort !== 'number') + if (localPort && typeof localPort !== 'number') { throw new TypeError('"localPort" option should be a number: ' + localPort); + } if (typeof port !== 'undefined') { - if (typeof port !== 'number' && typeof port !== 'string') + if (typeof port !== 'number' && typeof port !== 'string') { throw new TypeError('"port" option should be a number or string: ' + port); - if (!isLegalPort(port)) + } + if (!isLegalPort(port)) { throw new RangeError('"port" option should be >= 0 and < 65536: ' + port); + } } port |= 0; |