What is the problem this feature will solve?
When writing code that uses the promise based dns library, it's quite convenient to just import dns/promises.
However, when checking for the type of error with err.code, it's nicer and more robust to do a comparisons with the error code constants instead of doing a string comparison:
try {
res = await dns.resolve4([...])
} catch(e) {
if (e.code == dns.NOTFOUND) { // instead of e.code == 'ENOTFOUND'
[...]
}
}
However, unfortunately, NOTFOUND and friends are only exported from the dns module, not from dns/promises.
What is the feature you are proposing to solve the problem?
Re-Export all dns error code constants from dns/promises.
What alternatives have you considered?
Alternatively, code needs to either import dns and dns/promises under different names (which might be a bit confusing), or just import dns and use the promise based api through dns.promises (seems needlessly verbose).
What is the problem this feature will solve?
When writing code that uses the promise based dns library, it's quite convenient to just import
dns/promises.However, when checking for the type of error with
err.code, it's nicer and more robust to do a comparisons with the error code constants instead of doing a string comparison:However, unfortunately,
NOTFOUNDand friends are only exported from thednsmodule, not fromdns/promises.What is the feature you are proposing to solve the problem?
Re-Export all dns error code constants from
dns/promises.What alternatives have you considered?
Alternatively, code needs to either import
dnsanddns/promisesunder different names (which might be a bit confusing), or just importdnsand use the promise based api throughdns.promises(seems needlessly verbose).