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>
This commit is contained in:
Chris Dickinson authored and Trevor Norris committed 2014-06-24 17:08:57 -07:00
1 parent a55c60c715
commit 61baefce1e
2 files changed
+49 -1

No files matched your search

+5 -1
View File
@@ -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;