feat: 凭据刷新部分添加一些 context 方便调试

This commit is contained in:
amtoaer
2025-11-21 10:50:52 +08:00
parent c854e4e889
commit 688c8cec6a
2 changed files with 22 additions and 8 deletions

View File

@@ -309,15 +309,21 @@ async fn check_and_refresh_credential(
bili_client: &BiliClient,
config: &Config,
) -> Result<()> {
if let Some(new_credential) = bili_client
match bili_client
.check_refresh(&config.credential)
.await
.context("检查刷新 Credential 失败")?
{
VersionedConfig::get()
.update_credential(new_credential, connection)
.await
.context("更新 Credential 失败")?;
None => {
info!("Credential 无需刷新");
}
Some(new_credential) => {
VersionedConfig::get()
.update_credential(new_credential, connection)
.await
.context("新 Credential 持久化失败")?;
info!("Credential 已刷新并保存");
}
}
Ok(())
}