From 90ced9287626492898f2eb9bfd3b079171faf6ea Mon Sep 17 00:00:00 2001 From: lloydzhou Date: Fri, 25 Oct 2024 18:05:29 +0800 Subject: [PATCH] update --- src-tauri/src/stream.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/stream.rs b/src-tauri/src/stream.rs index d31dd67c3dc..8320db3e48a 100644 --- a/src-tauri/src/stream.rs +++ b/src-tauri/src/stream.rs @@ -119,7 +119,9 @@ pub async fn stream_fetch( } } Err(err) => { - let error: String = err.source().expect("REASON").to_string(); + let error: String = err.source() + .map(|e| e.to_string()) + .unwrap_or_else(|| "Unknown error occurred".to_string()); println!("Error response: {:?}", error); tauri::async_runtime::spawn( async move { if let Err(e) = window.emit(event_name, ChunkPayload{ request_id, chunk: error.into() }) {