From 8093b4fa6b72db33e44f05b7c524d2c3ddd68b9b 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. --- 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 b5d89625b2bc69..5ab75b26c7a7c3 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -430,8 +430,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 07c2189d97db43..7ef5b9cd3591b2 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}` }); });