Skip to content

Commit

Permalink
lib: fix consistency of methods that emit warnings
Browse files Browse the repository at this point in the history
PR-URL: #41249
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
  • Loading branch information
kuriyosh authored and danielleadams committed Mar 3, 2022
1 parent 26fc1e8 commit 9feab92
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions lib/internal/dns/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,16 @@ function validateHints(hints) {
}

let invalidHostnameWarningEmitted = false;

function emitInvalidHostnameWarning(hostname) {
if (invalidHostnameWarningEmitted) {
return;
if (!invalidHostnameWarningEmitted) {
process.emitWarning(
`The provided hostname "${hostname}" is not a valid ` +
'hostname, and is supported in the dns module solely for compatibility.',
'DeprecationWarning',
'DEP0118'
);
invalidHostnameWarningEmitted = true;
}
invalidHostnameWarningEmitted = true;
process.emitWarning(
`The provided hostname "${hostname}" is not a valid ` +
'hostname, and is supported in the dns module solely for compatibility.',
'DeprecationWarning',
'DEP0118'
);
}

let dnsOrder = getOptionValue('--dns-result-order') || 'ipv4first';
Expand Down

0 comments on commit 9feab92

Please sign in to comment.