From b128c053475a272bff5274693dfe7ff8b0cf805c Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Sun, 8 Jan 2023 18:03:08 +0100 Subject: [PATCH 1/4] doc: duplex and readable from uncaught execption warning --- doc/api/stream.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/doc/api/stream.md b/doc/api/stream.md index b3f487c4fbf6fb..a451045aa4cc15 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -2914,6 +2914,19 @@ Calling `Readable.from(string)` or `Readable.from(buffer)` will not have the strings or buffers be iterated to match the other streams semantics for performance reasons. +If an `Iterable` object containing promises is passed as an argument, +it could result in uncaught exceptions. +See the example below: + +```js +const { Readable } = require('node:stream'); + +Readable.from([ + new Promise((resolve) => setTimeout(resolve('1'), 1500)), + new Promise((_, reject) => setTimeout(reject(new Error('2')), 1000)), // Uncaught exception +]); +``` + ### `stream.Readable.fromWeb(readableStream[, options])`