diff --git a/lib/internal/dns/utils.js b/lib/internal/dns/utils.js index f15f8c7a779ce1..8fd5e2018f2d9c 100644 --- a/lib/internal/dns/utils.js +++ b/lib/internal/dns/utils.js @@ -32,7 +32,6 @@ const IPv6RE = /^\[([^[\]]*)\]/; const addrSplitRE = /(^.+?)(?::(\d+))?$/; const { ERR_DNS_SET_SERVERS_FAILED, - ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, ERR_INVALID_IP_ADDRESS, } = errors.codes; @@ -131,8 +130,8 @@ class Resolver { setLocalAddress(ipv4, ipv6) { validateString(ipv4, 'ipv4'); - if (typeof ipv6 !== 'string' && ipv6 !== undefined) { - throw new ERR_INVALID_ARG_TYPE('ipv6', ['String', 'undefined'], ipv6); + if (ipv6 !== undefined) { + validateString(ipv6, 'ipv6'); } this._handle.setLocalAddress(ipv4, ipv6);