Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0f3287d

Browse filesBrowse files
kuriyoshdanielleadams
authored andcommitted
lib: fix consistency of methods that emit warnings
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>
1 parent 0805068 commit 0f3287d
Copy full SHA for 0f3287d

File tree

Expand file treeCollapse file tree

1 file changed

+8
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-10
lines changed
Open diff view settings
Collapse file

‎lib/internal/dns/utils.js‎

Copy file name to clipboardExpand all lines: lib/internal/dns/utils.js
+8-10Lines 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 dnsOrder = getOptionValue('--dns-result-order') || 'ipv4first';

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.