From 4f094c0ae60beb8a3eb569a6a2d8c608bff1dbeb Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Tue, 2 Apr 2019 05:00:10 +0200 Subject: [PATCH] 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 Reviewed-By: Luigi Pinca Reviewed-By: Yongsheng Zhang --- lib/buffer.js | 3 +-- 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 3cc9e77a6c9..24a24f369be 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 07c2189d97d..7ef5b9cd359 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}` }); });