Skip to content

Commit f84132d

Browse files
committed
lib: fix consistency of methods that emit warnings
1 parent cf69964 commit f84132d

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

lib/internal/dns/utils.js

Lines changed: 8 additions & 10 deletions
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)