fix: handle segment download error

This commit is contained in:
Xinrea
2025-10-25 11:12:34 +08:00
parent 136e1a3774
commit 35d068e109

View File

@@ -303,6 +303,11 @@ async fn download_inner(
std::fs::create_dir_all(path.parent().unwrap()).unwrap();
}
let response = client.get(url).send().await?;
if !response.status().is_success() {
let status = response.status();
log::warn!("Download segment failed: {url}: {status}");
return Err(RecorderError::InvalidResponseStatus { status });
}
let bytes = response.bytes().await?;
let size = bytes.len() as u64;
let mut file = tokio::fs::File::create(&path).await?;