From 798170a7dbbdec200dd431a332ae251f1d594bb4 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Tue, 30 Dec 2025 10:46:11 -0800 Subject: [PATCH] Fix: Append error messages to the chat stream --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 08d2240..f218596 100644 --- a/index.js +++ b/index.js @@ -414,9 +414,11 @@ export class MyDurableObject { fail(message) { if (this.phase !== 'running') return; + const errStr = String(message || 'stream_failed'); + this.queueDelta(`\n\nRun failed: ${errStr}`); this.flush(true); this.phase = 'error'; - this.error = String(message || 'stream_failed'); + this.error = errStr; try { this.controller?.abort(); } catch {} try { this.oaStream?.controller?.abort(); } catch {} this.saveSnapshot();