GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — stream: fix fromSync() async input error messages · nodejs/node@2184500

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/streams/iter
    • from.js
  • test/parallel
    • test-stream-iter-from-sync.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/streams/iter/from.js‎

Copy file name to clipboardExpand all lines: lib/internal/streams/iter/from.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ function fromSync(input) {
700700
if (!isIterable && isAsyncIterable(input)) {
701701
throw new ERR_INVALID_ARG_TYPE(
702702
'input',
703-
'a synchronous input (not AsyncIterable)',
703+
'a synchronous input, not an async iterable',
704704
input,
705705
);
706706
}
@@ -710,7 +710,7 @@ function fromSync(input) {
710710
typeof input.then === 'function') {
711711
throw new ERR_INVALID_ARG_TYPE(
712712
'input',
713-
'a synchronous input (not Promise)',
713+
'a synchronous input, not a promise',
714714
input,
715715
);
716716
}
Collapse file

‎test/parallel/test-stream-iter-from-sync.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-stream-iter-from-sync.js
+8-3Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,10 @@ function testFromSyncIgnoresAsyncStreamable() {
183183
// Explicit async iterable rejected
184184
function testFromSyncRejectsAsyncIterable() {
185185
async function* gen() { yield [new TextEncoder().encode('a')]; }
186-
assert.throws(() => fromSync(gen()), { code: 'ERR_INVALID_ARG_TYPE' });
186+
assert.throws(() => fromSync(gen()), {
187+
code: 'ERR_INVALID_ARG_TYPE',
188+
message: /must be a synchronous input, not an async iterable\./,
189+
});
187190
}
188191

189192
function testFromSyncPrefersIteratorForDualIterable() {
@@ -212,8 +215,10 @@ function testFromSyncPrefersIteratorForThenableIterable() {
212215

213216
// Promise rejected
214217
function testFromSyncRejectsPromise() {
215-
assert.throws(() => fromSync(Promise.resolve('hello')),
216-
{ code: 'ERR_INVALID_ARG_TYPE' });
218+
assert.throws(() => fromSync(Promise.resolve('hello')), {
219+
code: 'ERR_INVALID_ARG_TYPE',
220+
message: /must be a synchronous input, not a promise\./,
221+
});
217222
}
218223

219224
// DataView input should be converted to Uint8Array (zero-copy)

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.