Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 883281b

Browse filesBrowse files
ah-yuMylesBorins
authored andcommitted
buffer: don't predefine error
PR-URL: #17021 Fixes: #16994 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 16f181e commit 883281b
Copy full SHA for 883281b

File tree

Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed
Open diff view settings
Collapse file

‎lib/buffer.js‎

Copy file name to clipboardExpand all lines: lib/buffer.js
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -449,14 +449,12 @@ Buffer.isEncoding = function isEncoding(encoding) {
449449
};
450450
Buffer[kIsEncodingSymbol] = Buffer.isEncoding;
451451

452-
const kConcatErr = new errors.TypeError(
453-
'ERR_INVALID_ARG_TYPE', 'list', ['Array', 'Buffer', 'Uint8Array']
454-
);
455-
456452
Buffer.concat = function concat(list, length) {
457453
var i;
458454
if (!Array.isArray(list))
459-
throw kConcatErr;
455+
throw new errors.TypeError(
456+
'ERR_INVALID_ARG_TYPE', 'list', ['Array', 'Buffer', 'Uint8Array']
457+
);
460458

461459
if (list.length === 0)
462460
return new FastBuffer();
@@ -474,7 +472,9 @@ Buffer.concat = function concat(list, length) {
474472
for (i = 0; i < list.length; i++) {
475473
var buf = list[i];
476474
if (!isUint8Array(buf))
477-
throw kConcatErr;
475+
throw new errors.TypeError(
476+
'ERR_INVALID_ARG_TYPE', 'list', ['Array', 'Buffer', 'Uint8Array']
477+
);
478478
_copy(buf, buffer, pos);
479479
pos += buf.length;
480480
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.