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 b36c726

Browse filesBrowse files
starkwangMylesBorins
authored andcommitted
stream: improve the error message of ERR_INVALID_ARG_TYPE
The `expected` argument of `ERR_INVALID_ARG_TYPE` can be an array, which is better than a single string. PR-URL: #17145 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
1 parent 2fccf84 commit b36c726
Copy full SHA for b36c726

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

+3
-2
lines changed
Open diff view settings
Collapse file

‎lib/_stream_readable.js‎

Copy file name to clipboardExpand all lines: lib/_stream_readable.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ function chunkInvalid(state, chunk) {
285285
chunk !== undefined &&
286286
!state.objectMode) {
287287
er = new errors.TypeError('ERR_INVALID_ARG_TYPE',
288-
'chunk', 'string/Buffer/Uint8Array');
288+
'chunk', ['string', 'Buffer', 'Uint8Array']);
289289
}
290290
return er;
291291
}
Collapse file

‎lib/_stream_writable.js‎

Copy file name to clipboardExpand all lines: lib/_stream_writable.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@ function validChunk(stream, state, chunk, cb) {
252252
} else if (typeof chunk !== 'string' &&
253253
chunk !== undefined &&
254254
!state.objectMode) {
255-
er = new errors.TypeError('ERR_INVALID_ARG_TYPE', 'chunk', 'string/buffer');
255+
er = new errors.TypeError('ERR_INVALID_ARG_TYPE', 'chunk',
256+
['string', 'Buffer']);
256257
}
257258
if (er) {
258259
stream.emit('error', er);

0 commit comments

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