mirror of
https://github.com/alterware/alterware-launcher.git
synced 2025-12-04 07:17:50 +00:00
more detailed errors
This commit is contained in:
@@ -49,9 +49,13 @@ pub async fn download_file_progress(
|
|||||||
let mut stream = res.bytes_stream();
|
let mut stream = res.bytes_stream();
|
||||||
|
|
||||||
while let Some(item) = stream.next().await {
|
while let Some(item) = stream.next().await {
|
||||||
let chunk = item.or(Err("Error while downloading file"))?;
|
let chunk = match item {
|
||||||
file.write_all(&chunk)
|
Ok(v) => v,
|
||||||
.or(Err("Error while writing to file"))?;
|
Err(e) => return Err(format!("Error while downloading file: {e}"))
|
||||||
|
};
|
||||||
|
if let Err(e) = file.write_all(&chunk) {
|
||||||
|
Err(format!("Error while writing to file: {e}"))?
|
||||||
|
}
|
||||||
let new = min(downloaded + (chunk.len() as u64), total_size);
|
let new = min(downloaded + (chunk.len() as u64), total_size);
|
||||||
downloaded = new;
|
downloaded = new;
|
||||||
pb.set_position(new);
|
pb.set_position(new);
|
||||||
|
|||||||
Reference in New Issue
Block a user