From fcd9f144574bf46741123b3adbabbbdea59f6511 Mon Sep 17 00:00:00 2001 From: benStre Date: Sun, 11 Feb 2024 16:18:03 +0100 Subject: [PATCH] handle closed datex stream --- types/stream.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/types/stream.ts b/types/stream.ts index 907dc85d..942f40e6 100644 --- a/types/stream.ts +++ b/types/stream.ts @@ -1,7 +1,6 @@ import { ReadableStream } from "../runtime/runtime.ts"; import { Pointer } from "../runtime/pointers.ts"; import type { datex_scope } from "../utils/global_types.ts"; -import { TypedArray } from "../utils/global_values.ts"; import { StreamConsumer } from "./abstract_types.ts"; import { Logger } from "../utils/logger.ts"; @@ -37,7 +36,12 @@ export class Stream implements StreamConsumer { } } - this.controller?.enqueue(chunk); + try { + this.controller?.enqueue(chunk); + } + catch (e) { + console.error("stream write error", e); + } } async pipe(in_stream:Stream|ReadableStream, scope?: datex_scope) { @@ -52,6 +56,7 @@ export class Stream implements StreamConsumer { close() { this.controller?.close() + this.controller = undefined; } getReader() {