Skip to content

Commit 0544075

Browse files
mscdexBridgeAR
authored andcommitted
buffer: correct concat() error message
PR-URL: #29198 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 925141f commit 0544075

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/buffer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ Buffer.concat = function concat(list, length) {
525525
// TODO(BridgeAR): This should not be of type ERR_INVALID_ARG_TYPE.
526526
// Instead, find the proper error code for this.
527527
throw new ERR_INVALID_ARG_TYPE(
528-
`list[${i}]`, ['Array', 'Buffer', 'Uint8Array'], list[i]);
528+
`list[${i}]`, ['Buffer', 'Uint8Array'], list[i]);
529529
}
530530
_copy(buf, buffer, pos);
531531
pos += buf.length;

test/parallel/test-buffer-concat.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ assert.strictEqual(flatLongLen.toString(), check);
5959
Buffer.concat(value);
6060
}, {
6161
code: 'ERR_INVALID_ARG_TYPE',
62-
message: 'The "list[0]" argument must be one of type Array, Buffer, ' +
62+
message: 'The "list[0]" argument must be one of type Buffer ' +
6363
`or Uint8Array. Received type ${typeof value[0]}`
6464
});
6565
});
@@ -68,7 +68,7 @@ assert.throws(() => {
6868
Buffer.concat([Buffer.from('hello'), 3]);
6969
}, {
7070
code: 'ERR_INVALID_ARG_TYPE',
71-
message: 'The "list[1]" argument must be one of type Array, Buffer, ' +
71+
message: 'The "list[1]" argument must be one of type Buffer ' +
7272
'or Uint8Array. Received type number'
7373
});
7474

0 commit comments

Comments
 (0)