Re-export error code constants from dns/promises
#43140
Labels
feature request
Issues that request new features to be added to Node.js.
dns/promises
#43140
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,
NOTFOUND
and friends are only exported from thedns
module, 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
dns
anddns/promises
under different names (which might be a bit confusing), or just importdns
and use the promise based api throughdns.promises
(seems needlessly verbose).The text was updated successfully, but these errors were encountered: