diff --git a/src/node_cares.cc b/src/node_cares.cc index 0cffbda34d..4b0d7d5b9a 100644 --- a/src/node_cares.cc +++ b/src/node_cares.cc @@ -216,6 +216,7 @@ static void ResolveError(Persistent &cb, int status) { Local obj = e->ToObject(); obj->Set(String::NewSymbol("errno"), Integer::New(status)); + obj->Set(String::NewSymbol("code"), code); TryCatch try_catch; diff --git a/test/simple/test-http-dns-fail.js b/test/simple/test-http-dns-fail.js index 3b8ebb9b5a..3d2f9f7d9f 100644 --- a/test/simple/test-http-dns-fail.js +++ b/test/simple/test-http-dns-fail.js @@ -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) })