tjfontaine / node-dns

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

dns.resolveMx // undefined #79

Open sebwaks opened 9 years ago

sebwaks commented 9 years ago

Great module but see code bellow

var domain ='idonexist'; dns.resolveMx(domain, function (err, dnsresults) { if (err) { console.log(err);

                            } else {
                                console.log(dnsresults); //undefined

                            }
                        });

native-dns doesnt return err when domain does not exist , oob dns module does . It's would be nice to have it

update oob dns returns

{ [Error: queryMx ENODATA] code: 'ENODATA', errno: 'ENODATA', syscall: 'queryMx' }

mwmahlberg commented 9 years ago

Right, NX isn't neither undefined nor an error.

sebwaks commented 9 years ago

My suggestion shuld be ERROR

mwmahlberg commented 9 years ago

RFC says otherwise. Errors are reserved for the case that the resolver has an an internal error. But if it can't resolve the query, the supposed answer is NXDOMAIN for the example given. And of course it is different for the application if the resolver is broken or if it can't resolve the query.

sebwaks commented 9 years ago

ok :)