From cf18902fbf942b8bd7b3cdd76b7f1ff05926e0d7 Mon Sep 17 00:00:00 2001 From: neo <1100909+neowu@users.noreply.github.com> Date: Mon, 22 Apr 2024 11:57:10 +0800 Subject: [PATCH] refactor error handling --- src/gcloud/vertex.rs | 2 +- src/openai/chatgpt.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gcloud/vertex.rs b/src/gcloud/vertex.rs index 57b1dab..ab9fd9b 100644 --- a/src/gcloud/vertex.rs +++ b/src/gcloud/vertex.rs @@ -107,7 +107,7 @@ impl Vertex { let (tx, rx) = channel(64); let handle = tokio::spawn(read_response_stream(response, tx)); let function_call = self.process_response(rx, handler).await; - let _ = tokio::try_join!(handle)?; + handle.await??; Ok(function_call) } diff --git a/src/openai/chatgpt.rs b/src/openai/chatgpt.rs index 5fb39ad..018e0e4 100644 --- a/src/openai/chatgpt.rs +++ b/src/openai/chatgpt.rs @@ -96,7 +96,7 @@ impl ChatGPT { let handle = tokio::spawn(read_event_source(source, tx)); let function_call = self.process_event(rx, handler).await; - let _ = tokio::try_join!(handle)?; + handle.await??; Ok(function_call) }