Skip to content

Commit

Permalink
buffer: fix concat error message
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
BridgeAR authored and BethGriggs committed Apr 9, 2019
1 parent 5c39687 commit 2ba58a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-buffer-concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
});
});

Expand Down

0 comments on commit 2ba58a6

Please sign in to comment.