File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -303,6 +303,11 @@ export class StreamableHTTPServerTransport implements Transport {
303
303
res . on ( "close" , ( ) => {
304
304
this . _streamMapping . delete ( this . _standaloneSseStreamId ) ;
305
305
} ) ;
306
+
307
+ // Add error handler for standalone SSE stream
308
+ res . on ( "error" , ( error ) => {
309
+ this . onerror ?.( error as Error ) ;
310
+ } ) ;
306
311
}
307
312
308
313
/**
@@ -334,6 +339,11 @@ export class StreamableHTTPServerTransport implements Transport {
334
339
}
335
340
} ) ;
336
341
this . _streamMapping . set ( streamId , res ) ;
342
+
343
+ // Add error handler for replay stream
344
+ res . on ( "error" , ( error ) => {
345
+ this . onerror ?.( error as Error ) ;
346
+ } ) ;
337
347
} catch ( error ) {
338
348
this . onerror ?.( error as Error ) ;
339
349
}
@@ -520,6 +530,11 @@ export class StreamableHTTPServerTransport implements Transport {
520
530
this . _streamMapping . delete ( streamId ) ;
521
531
} ) ;
522
532
533
+ // Add error handler for stream write errors
534
+ res . on ( "error" , ( error ) => {
535
+ this . onerror ?.( error as Error ) ;
536
+ } ) ;
537
+
523
538
// handle each message
524
539
for ( const message of messages ) {
525
540
this . onmessage ?.( message , { authInfo, requestInfo } ) ;
You can’t perform that action at this time.
0 commit comments