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 <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
This commit is contained in:
Ruben Bridgewater 2019-04-02 05:00:10 +02:00
parent 0f190a5bed
commit 4f094c0ae6
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762
2 changed files with 3 additions and 4 deletions

View File

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

View File

@ -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}`
});
});