diff --git a/src/commands/source/download.rs b/src/commands/source/download.rs index b014ff1e..d5d9025a 100644 --- a/src/commands/source/download.rs +++ b/src/commands/source/download.rs @@ -139,6 +139,15 @@ async fn perform_download( Err(e) => return Err(e).with_context(|| anyhow!("Downloading '{}'", &source.url())), }; + if response.status() != reqwest::StatusCode::OK { + return Err(anyhow!( + "Received HTTP status code \"{}\" but \"{}\" is expected for a successful download", + response.status(), + reqwest::StatusCode::OK + )) + .with_context(|| anyhow!("Downloading \"{}\" failed", &source.url())); + } + progress .lock() .await