summaryrefslogtreecommitdiff
path: root/lib/net.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/net.js')
-rw-r--r--lib/net.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/net.js b/lib/net.js
index ecf7258e8b..a5f012ac33 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -968,19 +968,20 @@ function lookupAndConnect(self, options) {
if (!self.connecting) return;
if (err) {
- // net.createConnection() creates a net.Socket object and
- // immediately calls net.Socket.connect() on it (that's us).
- // There are no event listeners registered yet so defer the
- // error event to the next tick.
+ // net.createConnection() creates a net.Socket object and immediately
+ // calls net.Socket.connect() on it (that's us). There are no event
+ // listeners registered yet so defer the error event to the next tick.
+ // TODO(BridgeAR): The error could either originate from user code or
+ // by the C++ layer. The port is never the cause for the error as it is
+ // not used in the lookup. We should probably just remove this.
err.host = options.host;
err.port = options.port;
err.message = err.message + ' ' + options.host + ':' + options.port;
process.nextTick(connectErrorNT, self, err);
} else if (addressType !== 4 && addressType !== 6) {
- err = new ERR_INVALID_ADDRESS_FAMILY(addressType);
- err.host = options.host;
- err.port = options.port;
- err.message = err.message + ' ' + options.host + ':' + options.port;
+ err = new ERR_INVALID_ADDRESS_FAMILY(addressType,
+ options.host,
+ options.port);
process.nextTick(connectErrorNT, self, err);
} else {
self._unrefTimer();