From 36714e16c2ce99ce0874f57ded9ba0a9f1a036e1 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 Signed-off-by: Beth Griggs --- 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 c4b7e3165b8ae5..2c797033a3f2ee 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -446,8 +446,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}` }); });