Skip to content

Commit 1f5de39

Browse files
committed
fix: removed throw for errors that are only expected to be propagated through the streams
Other errors are critical and still throw within the stream handler. [ci skip]
1 parent 0c9bd4f commit 1f5de39

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/QUICStream.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -420,12 +420,7 @@ class QUICStream implements ReadableWritablePair<Uint8Array, Uint8Array> {
420420
);
421421
// This is idempotent and won't error even if it is already stopped
422422
this.readableController.error(reason);
423-
// This rejects the readableP if it exists
424-
// The pull method may be blocked by `await readableP`
425-
// When rejected, it will throw up the exception
426-
// However because the stream is errored, then
427-
// the exception has no effect, and any reads of this stream
428-
// will simply return `{ value: undefined, done: true }`
423+
// This rejects the readableP if it exists to release it from it's blocked state
429424
this.rejectReadableP?.(reason);
430425
this.dispatchEvent(
431426
new events.EventQUICStreamError({
@@ -600,10 +595,7 @@ class QUICStream implements ReadableWritablePair<Uint8Array, Uint8Array> {
600595
detail: e_,
601596
}),
602597
);
603-
// The pull doesn't need to throw it upwards, the controller.error
604-
// already ensures errored state, and any read operation will end up
605-
// throwing, but we do it here to be symmetric with write.
606-
throw reason;
598+
return;
607599
} else {
608600
const e_ = new errors.ErrorQUICStreamInternal(
609601
'Failed `streamRecv` on the readable stream',
@@ -687,7 +679,7 @@ class QUICStream implements ReadableWritablePair<Uint8Array, Uint8Array> {
687679
detail: e_,
688680
}),
689681
);
690-
throw reason;
682+
return;
691683
} else {
692684
const e_ = new errors.ErrorQUICStreamInternal(
693685
'Local stream writable could not `streamSend`',
@@ -750,7 +742,7 @@ class QUICStream implements ReadableWritablePair<Uint8Array, Uint8Array> {
750742
);
751743
// This fails the `close`, however no matter what
752744
// the writable stream is in a closed state.
753-
throw reason;
745+
return;
754746
} else {
755747
// This could happen due to `InvalidStreamState`
756748
const e_ = new errors.ErrorQUICStreamInternal(

0 commit comments

Comments
 (0)