Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
BridgeAR committed Jun 16, 2017
1 parent 097aea4 commit a4d753f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const WriteWrap = process.binding('stream_wrap').WriteWrap;
const async_id_symbol = process.binding('async_wrap').async_id_symbol;
const { newUid, setInitTriggerId } = require('async_hooks');
const nextTick = require('internal/process/next_tick').nextTick;
const errors = require('internal/errors');

var cluster;
var dns;
Expand Down Expand Up @@ -873,7 +874,7 @@ function internalConnect(
var err;

if (typeof address !== 'string') {
throw new TypeError('Invalid address: ' + address);
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'address', 'string');
}

if (localAddress || localPort) {
Expand Down
7 changes: 2 additions & 5 deletions test/parallel/test-net-better-error-messages-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ const assert = require('assert');
}

{
try {
assert.throws(() => {
net.createConnection({ path: {} });
throw new Error('UNREACHABLE');
} catch (e) {
assert.strictEqual(e.message, 'Invalid address: [object Object]');
}
}, TypeError);
}

0 comments on commit a4d753f

Please sign in to comment.