Skip to content

Commit

Permalink
refactor: display a better error msg on status error (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
McPatate authored Jul 23, 2024
1 parent 0f07884 commit 27c5ab5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ async fn download_async(
.header(RANGE, "bytes=0-0")
.send()
.await
.map_err(|err| PyException::new_err(format!("Error while downloading: {err:?}")))?;
.map_err(|err| PyException::new_err(format!("Error while downloading: {err:?}")))?
.error_for_status()
.map_err(|err| PyException::new_err(err.to_string()))?;

// Only call the final redirect URL to avoid overloading the Hub with requests and also
// altering the download count
Expand Down

0 comments on commit 27c5ab5

Please sign in to comment.