From 0304f1fc22083dcf4fb45ea272f0f228850371e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Geisendo=CC=88rfer?= Date: Fri, 25 Feb 2011 10:27:52 +0100 Subject: [PATCH] Expose errno with a string for dns/cares This is to mirror the behavior introduced in aa95e5708f240810cd434911cf029f5ee70047d8. Closes GH-727. --- src/node_cares.cc | 1 + test/simple/test-http-dns-fail.js | 1 + 2 files changed, 2 insertions(+) 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) })