From 645e686822b94477d6c9517a95c9ca73f8cd71be Mon Sep 17 00:00:00 2001 From: amtoaer Date: Tue, 11 Nov 2025 14:42:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A1=AE=E4=BF=9D=E6=B5=81=E4=B8=AD?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E7=9A=84=E9=94=99=E8=AF=AF=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E8=83=BD=E5=A4=9F=E6=AD=A3=E7=A1=AE=E4=BF=9D=E7=95=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/bili_sync/src/workflow.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/bili_sync/src/workflow.rs b/crates/bili_sync/src/workflow.rs index f28e121..d1cf613 100644 --- a/crates/bili_sync/src/workflow.rs +++ b/crates/bili_sync/src/workflow.rs @@ -69,7 +69,14 @@ pub async fn refresh_video_source<'a>( .take_while(|(idx, res)| { match res { Err(e) => { - error = Err(anyhow!("{:#}", e)); + // 这里拿到的 e 是引用,无法直接传递所有权 + // 对于 BiliError,我们需要克隆内部的错误并附带原来的上下文,方便外部检查错误类型 + // 对于其他错误只保留字符串信息用作提示 + if let Some(inner) = e.downcast_ref::() { + error = Err(inner.clone()).context(e.to_string()); + } else { + error = Err(anyhow!("{:#}", e)); + } futures::future::ready(false) } Ok(v) => {