mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 19:08:17 +00:00

Adds localAddress and localPort to req so we have better error messages. Also fixes a case where ex is used before it is declared. PR-URL: https://github.com/nodejs/node/pull/3946 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
16 lines
398 B
JavaScript
16 lines
398 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const net = require('net');
|
|
|
|
var client = net.connect({
|
|
port: common.PORT + 1,
|
|
localPort: common.PORT,
|
|
localAddress: common.localhostIPv4
|
|
});
|
|
|
|
client.on('error', common.mustCall(function onError(err) {
|
|
assert.equal(err.localPort, common.PORT);
|
|
assert.equal(err.localAddress, common.localhostIPv4);
|
|
}));
|