lib: fix consistency of methods that emit warnings
PR-URL: https://github.com/nodejs/node/pull/41249 Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com>
This commit is contained in:
parent
806c7c13f3
commit
feafea1154
@ -178,18 +178,16 @@ function validateHints(hints) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let invalidHostnameWarningEmitted = false;
|
let invalidHostnameWarningEmitted = false;
|
||||||
|
|
||||||
function emitInvalidHostnameWarning(hostname) {
|
function emitInvalidHostnameWarning(hostname) {
|
||||||
if (invalidHostnameWarningEmitted) {
|
if (!invalidHostnameWarningEmitted) {
|
||||||
return;
|
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 typeCoercionWarningEmitted = false;
|
let typeCoercionWarningEmitted = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user