diff options
Diffstat (limited to 'lib/internal/crypto/hash.js')
-rw-r--r-- | lib/internal/crypto/hash.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/internal/crypto/hash.js b/lib/internal/crypto/hash.js index 41e00b88b9..d172a6a3c8 100644 --- a/lib/internal/crypto/hash.js +++ b/lib/internal/crypto/hash.js @@ -29,7 +29,7 @@ function Hash(algorithm, options) { if (!(this instanceof Hash)) return new Hash(algorithm, options); if (typeof algorithm !== 'string') - throw new ERR_INVALID_ARG_TYPE('algorithm', 'string'); + throw new ERR_INVALID_ARG_TYPE('algorithm', 'string', algorithm); this._handle = new _Hash(algorithm); this[kState] = { [kFinalized]: false @@ -56,7 +56,7 @@ Hash.prototype.update = function update(data, encoding) { if (typeof data !== 'string' && !isArrayBufferView(data)) { throw new ERR_INVALID_ARG_TYPE('data', - ['string', 'TypedArray', 'DataView']); + ['string', 'TypedArray', 'DataView'], data); } if (!this._handle.update(data, encoding || getDefaultEncoding())) @@ -84,9 +84,10 @@ function Hmac(hmac, key, options) { if (!(this instanceof Hmac)) return new Hmac(hmac, key, options); if (typeof hmac !== 'string') - throw new ERR_INVALID_ARG_TYPE('hmac', 'string'); + throw new ERR_INVALID_ARG_TYPE('hmac', 'string', hmac); if (typeof key !== 'string' && !isArrayBufferView(key)) { - throw new ERR_INVALID_ARG_TYPE('key', ['string', 'TypedArray', 'DataView']); + throw new ERR_INVALID_ARG_TYPE('key', + ['string', 'TypedArray', 'DataView'], key); } this._handle = new _Hmac(); this._handle.init(hmac, toBuf(key)); |