From b6d9ba93fa101deeb9920f29bee5f675591dacd5 Mon Sep 17 00:00:00 2001 From: lloydzhou Date: Mon, 30 Sep 2024 10:18:30 +0800 Subject: [PATCH] update --- src-tauri/src/stream.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/stream.rs b/src-tauri/src/stream.rs index 51d844305..938c663e1 100644 --- a/src-tauri/src/stream.rs +++ b/src-tauri/src/stream.rs @@ -95,14 +95,18 @@ pub async fn stream_fetch( match chunk { Ok(bytes) => { // println!("chunk: {:?}", bytes); - window.emit(event_name, ChunkPayload{ request_id, chunk: bytes }).unwrap(); + if let Err(e) = window.emit(event_name, ChunkPayload{ request_id, chunk: bytes }) { + println!("Failed to emit chunk payload: {:?}", e); + } } Err(err) => { println!("Error chunk: {:?}", err); } } } - window.emit(event_name, EndPayload { request_id, status: 0 }).unwrap(); + if let Err(e) = window.emit(event_name, EndPayload{ request_id, status: 0 }) { + println!("Failed to emit end payload: {:?}", e); + } }); StreamResponse {