summaryrefslogtreecommitdiff
path: root/lib/dns.js
diff options
context:
space:
mode:
authorChris Dickinson <christopher.s.dickinson@gmail.com>2014-06-04 17:26:34 -0700
committerTrevor Norris <trev.norris@gmail.com>2014-06-24 17:08:57 -0700
commit61baefce1e8cae13e40f01c04c8f684848cee3e2 (patch)
tree3d7381c9a8f694063a990743ebfbd88b02656efd /lib/dns.js
parenta55c60c71550dd82e7bdad4ae7df42e77631204f (diff)
downloadnodejs-61baefce1e8cae13e40f01c04c8f684848cee3e2.tar.gz
nodejs-61baefce1e8cae13e40f01c04c8f684848cee3e2.tar.bz2
nodejs-61baefce1e8cae13e40f01c04c8f684848cee3e2.zip
dns: send lookup c-ares errors to callback
Calling dns.lookup with arguments that generate an error from c-ares previously sent those errors back to the callback. This commit restores the ca9eb71 behavior. Fixes #7731. Signed-off-by: Trevor Norris <trev.norris@gmail.com> Signed-off-by: Fedor Indutny <fedor@indutny.com>
Diffstat (limited to 'lib/dns.js')
-rw-r--r--lib/dns.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/dns.js b/lib/dns.js
index ab80deb81..9634ea1c0 100644
--- a/lib/dns.js
+++ b/lib/dns.js
@@ -132,8 +132,12 @@ exports.lookup = function(hostname, family, callback) {
hostname: hostname,
oncomplete: onlookup
};
+
var err = cares.getaddrinfo(req, hostname, family);
- if (err) throw errnoException(err, 'getaddrinfo', hostname);
+ if (err) {
+ callback(errnoException(err, 'getaddrinfo', hostname));
+ return {};
+ }
callback.immediately = true;
return req;