File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -321,9 +321,13 @@ export function handleStreamingMode(
321321 await writer . write ( encoder . encode ( chunk ) ) ;
322322 }
323323 } catch ( error ) {
324- console . error ( error ) ;
324+ console . error ( 'Error during stream processing:' , error ) ;
325325 } finally {
326- writer . close ( ) ;
326+ try {
327+ await writer . close ( ) ;
328+ } catch ( closeError ) {
329+ console . error ( 'Failed to close the writer:' , closeError ) ;
330+ }
327331 }
328332 } ) ( ) ;
329333 } else {
@@ -341,9 +345,13 @@ export function handleStreamingMode(
341345 await writer . write ( encoder . encode ( chunk ) ) ;
342346 }
343347 } catch ( error ) {
344- console . error ( error ) ;
348+ console . error ( 'Error during stream processing:' , error ) ;
345349 } finally {
346- writer . close ( ) ;
350+ try {
351+ await writer . close ( ) ;
352+ } catch ( closeError ) {
353+ console . error ( 'Failed to close the writer:' , closeError ) ;
354+ }
347355 }
348356 } ) ( ) ;
349357 }
You can’t perform that action at this time.
0 commit comments