summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/http.ts
diff options
context:
space:
mode:
authorSatya Rohith <me@satyarohith.com>2024-06-25 17:02:40 +0530
committerGitHub <noreply@github.com>2024-06-25 17:02:40 +0530
commit13aa1d70e905f1e1ec57d7eb57ad57d09d09deb2 (patch)
tree1319fef940f019fce0acd80d7bb8b06bc693dd37 /ext/node/polyfills/http.ts
parentb71a85918815195a2a8ba070fb534e50938251bd (diff)
fix(ext/node): ignore stream error during enqueue (#24243)
Diffstat (limited to 'ext/node/polyfills/http.ts')
-rw-r--r--ext/node/polyfills/http.ts12
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts
index f009d8a9e..6880f7cb8 100644
--- a/ext/node/polyfills/http.ts
+++ b/ext/node/polyfills/http.ts
@@ -1346,10 +1346,14 @@ export class ServerResponse extends NodeWritable {
#socketOverride: any | null = null;
static #enqueue(controller: ReadableStreamDefaultController, chunk: Chunk) {
- if (typeof chunk === "string") {
- controller.enqueue(ENCODER.encode(chunk));
- } else {
- controller.enqueue(chunk);
+ try {
+ if (typeof chunk === "string") {
+ controller.enqueue(ENCODER.encode(chunk));
+ } else {
+ controller.enqueue(chunk);
+ }
+ } catch (_) {
+ // The stream might have been closed. Ignore the error.
}
}