Skip to content

Commit 4f094c0

Browse files
committed
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: nodejs#27050 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]>
1 parent 0f190a5 commit 4f094c0

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
@@ -432,8 +432,7 @@ Buffer[kIsEncodingSymbol] = Buffer.isEncoding;
432432
Buffer.concat = function concat(list, length) {
433433
let i;
434434
if (!Array.isArray(list)) {
435-
throw new ERR_INVALID_ARG_TYPE(
436-
'list', ['Array', 'Buffer', 'Uint8Array'], list);
435+
throw new ERR_INVALID_ARG_TYPE('list', 'Array', list);
437436
}
438437

439438
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)