Skip to content

Commit

Permalink
buffer: correct concat() error message
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mscdex authored and Trott committed Aug 22, 2019
1 parent 6afd1a3 commit 775048d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ Buffer.concat = function concat(list, length) {
// TODO(BridgeAR): This should not be of type ERR_INVALID_ARG_TYPE.
// Instead, find the proper error code for this.
throw new ERR_INVALID_ARG_TYPE(
`list[${i}]`, ['Array', 'Buffer', 'Uint8Array'], list[i]);
`list[${i}]`, ['Buffer', 'Uint8Array'], list[i]);
}
_copy(buf, buffer, pos);
pos += buf.length;
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 @@ -59,7 +59,7 @@ assert.strictEqual(flatLongLen.toString(), check);
Buffer.concat(value);
}, {
code: 'ERR_INVALID_ARG_TYPE',
message: 'The "list[0]" argument must be one of type Array, Buffer, ' +
message: 'The "list[0]" argument must be one of type Buffer ' +
`or Uint8Array. Received type ${typeof value[0]}`
});
});
Expand All @@ -68,7 +68,7 @@ assert.throws(() => {
Buffer.concat([Buffer.from('hello'), 3]);
}, {
code: 'ERR_INVALID_ARG_TYPE',
message: 'The "list[1]" argument must be one of type Array, Buffer, ' +
message: 'The "list[1]" argument must be one of type Buffer ' +
'or Uint8Array. Received type number'
});

Expand Down

0 comments on commit 775048d

Please sign in to comment.