diff options
Diffstat (limited to 'lib/dgram.js')
-rw-r--r-- | lib/dgram.js | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/dgram.js b/lib/dgram.js index b9caeddabe..355e7d2fbe 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -75,7 +75,7 @@ function newHandle(type, lookup) { if (lookup === undefined) lookup = dns.lookup; else if (typeof lookup !== 'function') - throw new ERR_INVALID_ARG_TYPE('lookup', 'Function'); + throw new ERR_INVALID_ARG_TYPE('lookup', 'Function', lookup); if (type === 'udp4') { const handle = new UDP(); @@ -299,19 +299,19 @@ Socket.prototype.sendto = function(buffer, address, callback) { if (typeof offset !== 'number') { - throw new ERR_INVALID_ARG_TYPE('offset', 'number'); + throw new ERR_INVALID_ARG_TYPE('offset', 'number', offset); } if (typeof length !== 'number') { - throw new ERR_INVALID_ARG_TYPE('length', 'number'); + throw new ERR_INVALID_ARG_TYPE('length', 'number', length); } if (typeof port !== 'number') { - throw new ERR_INVALID_ARG_TYPE('port', 'number'); + throw new ERR_INVALID_ARG_TYPE('port', 'number', port); } if (typeof address !== 'string') { - throw new ERR_INVALID_ARG_TYPE('address', 'string'); + throw new ERR_INVALID_ARG_TYPE('address', 'string', address); } this.send(buffer, offset, length, port, address, callback); @@ -323,7 +323,7 @@ function sliceBuffer(buffer, offset, length) { buffer = Buffer.from(buffer); } else if (!isUint8Array(buffer)) { throw new ERR_INVALID_ARG_TYPE('buffer', - ['Buffer', 'Uint8Array', 'string']); + ['Buffer', 'Uint8Array', 'string'], buffer); } offset = offset >>> 0; @@ -415,13 +415,14 @@ Socket.prototype.send = function(buffer, list = [ Buffer.from(buffer) ]; } else if (!isUint8Array(buffer)) { throw new ERR_INVALID_ARG_TYPE('buffer', - ['Buffer', 'Uint8Array', 'string']); + ['Buffer', 'Uint8Array', 'string'], + buffer); } else { list = [ buffer ]; } } else if (!(list = fixBufferList(buffer))) { throw new ERR_INVALID_ARG_TYPE('buffer list arguments', - ['Buffer', 'string']); + ['Buffer', 'string'], buffer); } port = port >>> 0; @@ -437,7 +438,7 @@ Socket.prototype.send = function(buffer, callback = address; address = undefined; } else if (address && typeof address !== 'string') { - throw new ERR_INVALID_ARG_TYPE('address', ['string', 'falsy']); + throw new ERR_INVALID_ARG_TYPE('address', ['string', 'falsy'], address); } this._healthCheck(); @@ -602,7 +603,8 @@ Socket.prototype.setMulticastInterface = function(interfaceAddress) { this._healthCheck(); if (typeof interfaceAddress !== 'string') { - throw new ERR_INVALID_ARG_TYPE('interfaceAddress', 'string'); + throw new ERR_INVALID_ARG_TYPE( + 'interfaceAddress', 'string', interfaceAddress); } const err = this._handle.setMulticastInterface(interfaceAddress); |