-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add address and/or port to errors where applicable for better reporting. In the event the local address and port are accessible, it will also add those to the error message. See nodejs/node-v0.x-archive#7005 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> PR-URL: #35
- Loading branch information
Showing
6 changed files
with
120 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var common = require('../common'); | ||
var assert = require('assert'); | ||
var net = require('net'); | ||
var fp = '/blah/fadfa'; | ||
var server = net.createServer(assert.fail); | ||
server.listen(fp, assert.fail); | ||
server.on('error', common.mustCall(function(e) { | ||
assert.equal(e.address, fp) | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var common = require('../common'); | ||
var assert = require('assert'); | ||
var net = require('net'); | ||
|
||
var server = net.createServer(assert.fail); | ||
server.listen(1, '1.1.1.1', assert.fail); | ||
server.on('error', common.mustCall(function(e) { | ||
assert.equal(e.address, '1.1.1.1'); | ||
assert.equal(e.port, 1); | ||
assert.equal(e.syscall, 'listen'); | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
var common = require('../common'); | ||
var net = require('net'); | ||
var assert = require('assert'); | ||
var fp = '/tmp/fadagagsdfgsdf'; | ||
var c = net.connect(fp); | ||
|
||
c.on('connect', assert.fail); | ||
|
||
c.on('error', common.mustCall(function(e) { | ||
assert.equal(e.code, 'ENOENT'); | ||
assert.equal(e.message, 'connect ENOENT ' + fp); | ||
})); |
13 changes: 13 additions & 0 deletions
13
test/simple/test-net-better-error-messages-port-hostname.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var common = require('../common'); | ||
var net = require('net'); | ||
var assert = require('assert'); | ||
|
||
var c = net.createConnection(common.PORT, 'blah.blah'); | ||
|
||
c.on('connect', assert.fail); | ||
|
||
c.on('error', common.mustCall(function(e) { | ||
assert.equal(e.code, 'ENOTFOUND'); | ||
assert.equal(e.port, common.PORT); | ||
assert.equal(e.hostname, 'blah.blah'); | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var common = require('../common'); | ||
var net = require('net'); | ||
var assert = require('assert'); | ||
|
||
var c = net.createConnection(common.PORT); | ||
|
||
c.on('connect', assert.fail); | ||
|
||
c.on('error', common.mustCall(function(e) { | ||
assert.equal(e.code, 'ECONNREFUSED'); | ||
assert.equal(e.port, common.PORT); | ||
assert.equal(e.address, '127.0.0.1'); | ||
})); |