Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Expose errno with a string.

  • Loading branch information...
commit aa95e5708f240810cd434911cf029f5ee70047d8 1 parent 1a7830a
ry ry authored
2  doc/api/net.markdown
View
@@ -70,7 +70,7 @@ another server is already running on the requested port. One way of handling thi
would be to wait a second and the try again. This can be done with
server.on('error', function (e) {
- if (e.errno == require('constants').EADDRINUSE) {
+ if (e.code == 'EADDRINUSE') {
console.log('Address in use, retrying...');
setTimeout(function () {
server.close();
3  src/node.cc
View
@@ -71,6 +71,7 @@ static Persistent<Object> process;
static Persistent<String> errno_symbol;
static Persistent<String> syscall_symbol;
static Persistent<String> errpath_symbol;
+static Persistent<String> code_symbol;
static Persistent<String> rss_symbol;
static Persistent<String> vsize_symbol;
@@ -1021,6 +1022,7 @@ Local<Value> ErrnoException(int errorno,
syscall_symbol = NODE_PSYMBOL("syscall");
errno_symbol = NODE_PSYMBOL("errno");
errpath_symbol = NODE_PSYMBOL("path");
+ code_symbol = NODE_PSYMBOL("code");
}
if (path) {
@@ -1035,6 +1037,7 @@ Local<Value> ErrnoException(int errorno,
Local<Object> obj = e->ToObject();
obj->Set(errno_symbol, Integer::New(errorno));
+ obj->Set(code_symbol, estring);
if (path) obj->Set(errpath_symbol, String::New(path));
if (syscall) obj->Set(syscall_symbol, String::NewSymbol(syscall));
return e;
1  test/simple/test-net-connect-handle-econnrefused.js
View
@@ -16,6 +16,7 @@ c.on('error', function(e) {
console.error('couldn\'t connect.');
gotError = true;
assert.equal(require('constants').ECONNREFUSED, e.errno);
+ assert.equal('ECONNREFUSED', e.code);
});
Please sign in to comment.
Something went wrong with that request. Please try again.