From f1c5c103bf56d6af73eb00b5351fd43cd8ed8f96 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Wed, 7 Jul 2021 15:01:22 +0200 Subject: [PATCH] fixuP --- lib/internal/streams/readable.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/internal/streams/readable.js b/lib/internal/streams/readable.js index 9dff2013a41da5..53cda0fd8f4723 100644 --- a/lib/internal/streams/readable.js +++ b/lib/internal/streams/readable.js @@ -1113,8 +1113,10 @@ async function* createAsyncIterator(stream, options) { const chunk = stream.destroyed ? null : stream.read(); if (chunk !== null) { yield chunk; - } else if (error !== undefined) { - break; + } else if (error) { + throw error; + } else if (error === null) { + return; } else { await new Promise(next); }