fix(katana): a chain of Ok Err

This commit is contained in:
tretrauit 2024-01-11 22:18:39 +07:00
parent 17dd04645a
commit cce8dedccf

View File

@ -501,7 +501,7 @@ pub async fn analyze_drop_message(message: &Message) -> Result<Vec<DroppedCard>,
Ok((i, execute_analyze_drop(card_img, i).await)) Ok((i, execute_analyze_drop(card_img, i).await))
}); });
} }
let mut handles: Vec<task::JoinHandle<Result<(u32, DroppedCard), String>>> = Vec::new(); let mut handles: Vec<task::JoinHandle<Result<(u32, Result<DroppedCard>), String>>> = Vec::new();
for job in jobs { for job in jobs {
let handle = task::spawn(job); let handle = task::spawn(job);
handles.push(handle); handles.push(handle);
@ -511,7 +511,11 @@ pub async fn analyze_drop_message(message: &Message) -> Result<Vec<DroppedCard>,
match result { match result {
Ok(result) => { Ok(result) => {
match 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); trace!("Finished analyzing card {}", i);
cards.push(card); cards.push(card);
} }