mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
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> Signed-off-by: Beth Griggs <Bethany.Griggs@uk.ibm.com>
This commit is contained in:
parent
5917f4d49b
commit
36714e16c2
|
|
@ -446,8 +446,7 @@ Buffer[kIsEncodingSymbol] = Buffer.isEncoding;
|
||||||
Buffer.concat = function concat(list, length) {
|
Buffer.concat = function concat(list, length) {
|
||||||
let i;
|
let i;
|
||||||
if (!Array.isArray(list)) {
|
if (!Array.isArray(list)) {
|
||||||
throw new ERR_INVALID_ARG_TYPE(
|
throw new ERR_INVALID_ARG_TYPE('list', 'Array', list);
|
||||||
'list', ['Array', 'Buffer', 'Uint8Array'], list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (list.length === 0)
|
if (list.length === 0)
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,8 @@ assert.strictEqual(flatLongLen.toString(), check);
|
||||||
Buffer.concat(value);
|
Buffer.concat(value);
|
||||||
}, {
|
}, {
|
||||||
code: 'ERR_INVALID_ARG_TYPE',
|
code: 'ERR_INVALID_ARG_TYPE',
|
||||||
message: 'The "list" argument must be one of type Array, Buffer, ' +
|
message: 'The "list" argument must be of type Array. ' +
|
||||||
`or Uint8Array. Received type ${typeof value}`
|
`Received type ${typeof value}`
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user