From cce8dedccf5ed8c6adfa81318510fffbae0037f8 Mon Sep 17 00:00:00 2001 From: tretrauit Date: Thu, 11 Jan 2024 22:18:39 +0700 Subject: [PATCH] fix(katana): a chain of Ok Err --- swordfish/src/katana.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/swordfish/src/katana.rs b/swordfish/src/katana.rs index 699dc0b..bfc7bde 100644 --- a/swordfish/src/katana.rs +++ b/swordfish/src/katana.rs @@ -501,7 +501,7 @@ pub async fn analyze_drop_message(message: &Message) -> Result, Ok((i, execute_analyze_drop(card_img, i).await)) }); } - let mut handles: Vec>> = Vec::new(); + let mut handles: Vec), String>>> = Vec::new(); for job in jobs { let handle = task::spawn(job); handles.push(handle); @@ -511,7 +511,11 @@ pub async fn analyze_drop_message(message: &Message) -> Result, match result { Ok(result) => { match result { - Ok((i, card)) => { + Ok((i, card_result)) => { + let card = match card_result { + Ok(card) => card, + Err(why) => return Err(format!("Failed to analyze card: {}", why)), + }; trace!("Finished analyzing card {}", i); cards.push(card); }