Skip to content

Commit 306dd1c

Browse files
kuriyoshBethGriggs
authored andcommitted
lib: fix consistency of methods that emit warnings
PR-URL: #41249 Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Mestery <[email protected]>
1 parent 09763a2 commit 306dd1c

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

lib/internal/dns/utils.js

+8-10
Original file line numberDiff line numberDiff line change
@@ -178,18 +178,16 @@ function validateHints(hints) {
178178
}
179179

180180
let invalidHostnameWarningEmitted = false;
181-
182181
function emitInvalidHostnameWarning(hostname) {
183-
if (invalidHostnameWarningEmitted) {
184-
return;
182+
if (!invalidHostnameWarningEmitted) {
183+
process.emitWarning(
184+
`The provided hostname "${hostname}" is not a valid ` +
185+
'hostname, and is supported in the dns module solely for compatibility.',
186+
'DeprecationWarning',
187+
'DEP0118'
188+
);
189+
invalidHostnameWarningEmitted = true;
185190
}
186-
invalidHostnameWarningEmitted = true;
187-
process.emitWarning(
188-
`The provided hostname "${hostname}" is not a valid ` +
189-
'hostname, and is supported in the dns module solely for compatibility.',
190-
'DeprecationWarning',
191-
'DEP0118'
192-
);
193191
}
194192

195193
let typeCoercionWarningEmitted = false;

0 commit comments

Comments
 (0)