node-dns icon indicating copy to clipboard operation
node-dns copied to clipboard

dns.resolveMx // undefined

Open sebwaks opened this issue 10 years ago • 4 comments

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' }

sebwaks avatar Sep 15 '14 20:09 sebwaks

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

mwmahlberg avatar Sep 16 '14 09:09 mwmahlberg

My suggestion shuld be ERROR

sebwaks avatar Sep 16 '14 09:09 sebwaks

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.

mwmahlberg avatar Sep 16 '14 09:09 mwmahlberg

ok :)

sebwaks avatar Sep 16 '14 10:09 sebwaks