Skip to content

Commit 2ba58a6

Browse files
BridgeARBethGriggs
authored andcommitted
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: #27050 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Signed-off-by: Beth Griggs <Bethany.Griggs@uk.ibm.com>
1 parent 5c39687 commit 2ba58a6

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

lib/buffer.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,7 @@ Buffer[kIsEncodingSymbol] = Buffer.isEncoding;
446446
Buffer.concat = function concat(list, length) {
447447
let i;
448448
if (!Array.isArray(list)) {
449-
throw new ERR_INVALID_ARG_TYPE(
450-
'list', ['Array', 'Buffer', 'Uint8Array'], list);
449+
throw new ERR_INVALID_ARG_TYPE('list', 'Array', list);
451450
}
452451

453452
if (list.length === 0)

test/parallel/test-buffer-concat.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ assert.strictEqual(flatLongLen.toString(), check);
4949
Buffer.concat(value);
5050
}, {
5151
code: 'ERR_INVALID_ARG_TYPE',
52-
message: 'The "list" argument must be one of type Array, Buffer, ' +
53-
`or Uint8Array. Received type ${typeof value}`
52+
message: 'The "list" argument must be of type Array. ' +
53+
`Received type ${typeof value}`
5454
});
5555
});
5656

0 commit comments

Comments
 (0)