stream: fix the ReadableStreamBYOBReader error message

PR-URL: https://github.com/nodejs/node/pull/40846
Reviewed-By: Robert Nagy <ronagy@icloud.com>
This commit is contained in:
James M Snell authored and Michaël Zasso committed 2021-11-26 15:36:36 +01:00
1 parent 65b33ba510
commit dc99ae3bd6
2 files changed
+7 -3

No files matched your search

+3 -1
View File
@@ -508,6 +508,8 @@ class ReadableStream {
return customInspect(depth, options, this[kType], {
locked: this.locked,
state: this[kState].state,
supportsBYOB:
this[kState].controller instanceof ReadableByteStreamController,
});
}
@@ -1745,7 +1747,7 @@ function setupReadableStreamBYOBReader(reader, stream) {
controller,
} = stream[kState];
if (!isReadableByteStreamController(controller))
throw new ERR_INVALID_ARG_VALUE('reader', reader, 'must be a byte stream');
throw new ERR_INVALID_ARG_VALUE('stream', stream, 'must be a byte stream');
readableStreamReaderGenericInitialize(reader, stream);
reader[kState].readIntoRequests = [];
}
+4 -2
View File
@@ -1410,10 +1410,12 @@ class Source {
assert.strictEqual(
inspect(readable),
'ReadableStream { locked: false, state: \'readable\' }');
'ReadableStream { locked: false, state: \'readable\', ' +
'supportsBYOB: false }');
assert.strictEqual(
inspect(readable, { depth: null }),
'ReadableStream { locked: false, state: \'readable\' }');
'ReadableStream { locked: false, state: \'readable\', ' +
'supportsBYOB: false }');
assert.strictEqual(
inspect(readable, { depth: 0 }),
'ReadableStream [Object]');