Skip to content

Commit

Permalink
fix: ignore error if stream is ended
Browse files Browse the repository at this point in the history
  • Loading branch information
bill-min authored and DylanPiercey committed May 29, 2024
1 parent 3514bad commit 39eaf14
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/util/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ export function createWritable(): StreamWritable {
},
error(reason: unknown) {
error = reason;
done = true;
buf = "";

if (pending) {
Expand All @@ -122,10 +121,6 @@ export function createWritable(): StreamWritable {
}
},
async next() {
if (error) {
throw error;
}

if (buf) {
const value = buf;
buf = "";
Expand All @@ -142,6 +137,10 @@ export function createWritable(): StreamWritable {
};
}

if (error) {
throw error;
}

await (pending = createDeferred());
return this.next();
},
Expand Down

0 comments on commit 39eaf14

Please sign in to comment.