tjfontaine / node-dns

Replacement dns module in pure javascript for node.js
MIT License
585 stars 154 forks source link

uncaughtException in reverse #103

Open zarmack opened 9 years ago

zarmack commented 9 years ago

Hi,

When I'm triing to make a reverse lookup to a dns server (tinydns) and doesn't respond, native-dns drops an uncaughtException that isn't caught by the try / catch. The error is:

events.js:72 throw er; // Unhandled 'error' event ^ Error: connect ECONNREFUSED at errnoException (net.js:904:11) at Object.afterConnect [as oncomplete] (net.js:895:19)

The code that generates the error, is:

var remoteip = 8.8.8.8; ndns.platform.timeout = 500; ndns.platform.name_servers.length = 0; ndns.platform.name_servers.push({address: '178.62.48.121', port: 53, type: "udp"});

try { var dreq = ndns.reverse(remoteip, function(error, result) { if(error) { callback(error, null); } else callback(null, true); }); } catch(error) { console.log(error); callback(error, null); }

Best regards, Zarmack

coolaj86 commented 8 years ago

Did you have error and socketError handlers attached?