Expose errno with a string for dns/cares
authorFelix Geisendörfer <felix@debuggable.com>
Fri, 25 Feb 2011 09:27:52 +0000 (10:27 +0100)
committerRyan Dahl <ry@tinyclouds.org>
Mon, 28 Feb 2011 17:54:16 +0000 (09:54 -0800)
This is to mirror the behavior introduced in
aa95e5708f240810cd434911cf029f5ee70047d8.

Closes GH-727.

src/node_cares.cc
test/simple/test-http-dns-fail.js

index 0cffbda..4b0d7d5 100644 (file)
@@ -216,6 +216,7 @@ static void ResolveError(Persistent<Function> &cb, int status) {
 
   Local<Object> obj = e->ToObject();
   obj->Set(String::NewSymbol("errno"), Integer::New(status));
+  obj->Set(String::NewSymbol("code"), code);
 
   TryCatch try_catch;
 
index 3b8ebb9..3d2f9f7 100644 (file)
@@ -24,6 +24,7 @@ function httpreq(count) {
 
   req.on('error', function(e){
     console.log(e.message);
+    assert.strictEqual(e.code, 'ENOTFOUND');
     hadError++
     httpreq(count + 1)
   })