File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -245,6 +245,17 @@ export function createSSEStream(params: StreamingOrchestrationParams): ReadableS
245245 }
246246 }
247247
248+ const pushEventBestEffort = async ( event : Record < string , any > ) => {
249+ try {
250+ await pushEvent ( event )
251+ } catch ( error ) {
252+ logger . error ( `[${ requestId } ] Failed to push event` , {
253+ eventType : event . type ,
254+ error : error instanceof Error ? error . message : String ( error ) ,
255+ } )
256+ }
257+ }
258+
248259 if ( chatId ) {
249260 await pushEvent ( { type : 'chat_id' , chatId } )
250261 }
@@ -308,7 +319,7 @@ export function createSSEStream(params: StreamingOrchestrationParams): ReadableS
308319 logger . error ( `[${ requestId } ] Orchestration returned failure` , {
309320 error : errorMessage ,
310321 } )
311- await pushEvent ( {
322+ await pushEventBestEffort ( {
312323 type : 'error' ,
313324 error : errorMessage ,
314325 data : {
@@ -348,7 +359,7 @@ export function createSSEStream(params: StreamingOrchestrationParams): ReadableS
348359 }
349360 logger . error ( `[${ requestId } ] Orchestration error:` , error )
350361 const errorMessage = error instanceof Error ? error . message : 'Stream error'
351- await pushEvent ( {
362+ await pushEventBestEffort ( {
352363 type : 'error' ,
353364 error : errorMessage ,
354365 data : {
You can’t perform that action at this time.
0 commit comments