diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2019-04-02 05:00:10 +0200 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2019-04-04 14:21:11 +0200 |
commit | 4f094c0ae60beb8a3eb569a6a2d8c608bff1dbeb (patch) | |
tree | 3ad2571d014a187aec670d647889fbdda43b10d4 | |
parent | 0f190a5bed14bf9f7392af889f3f83306bedae97 (diff) | |
download | android-node-v8-4f094c0ae60beb8a3eb569a6a2d8c608bff1dbeb.tar.gz android-node-v8-4f094c0ae60beb8a3eb569a6a2d8c608bff1dbeb.tar.bz2 android-node-v8-4f094c0ae60beb8a3eb569a6a2d8c608bff1dbeb.zip |
buffer: fix concat error message
The list argument may only be of type array, not of any other type
as it actually suggests.
PR-URL: https://github.com/nodejs/node/pull/27050
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
-rw-r--r-- | lib/buffer.js | 3 | ||||
-rw-r--r-- | test/parallel/test-buffer-concat.js | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/lib/buffer.js b/lib/buffer.js index 3cc9e77a6c..24a24f369b 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -432,8 +432,7 @@ Buffer[kIsEncodingSymbol] = Buffer.isEncoding; Buffer.concat = function concat(list, length) { let i; if (!Array.isArray(list)) { - throw new ERR_INVALID_ARG_TYPE( - 'list', ['Array', 'Buffer', 'Uint8Array'], list); + throw new ERR_INVALID_ARG_TYPE('list', 'Array', list); } if (list.length === 0) diff --git a/test/parallel/test-buffer-concat.js b/test/parallel/test-buffer-concat.js index 07c2189d97..7ef5b9cd35 100644 --- a/test/parallel/test-buffer-concat.js +++ b/test/parallel/test-buffer-concat.js @@ -49,8 +49,8 @@ assert.strictEqual(flatLongLen.toString(), check); Buffer.concat(value); }, { code: 'ERR_INVALID_ARG_TYPE', - message: 'The "list" argument must be one of type Array, Buffer, ' + - `or Uint8Array. Received type ${typeof value}` + message: 'The "list" argument must be of type Array. ' + + `Received type ${typeof value}` }); }); |