diff --git a/src/run/uploader/upload.rs b/src/run/uploader/upload.rs index b02375ab..06c61937 100644 --- a/src/run/uploader/upload.rs +++ b/src/run/uploader/upload.rs @@ -44,7 +44,7 @@ async fn retrieve_upload_data( match response { Ok(response) => { - if response.status().is_client_error() { + if !response.status().is_success() { let status = response.status(); let text = response.text().await?; let mut error_message = serde_json::from_str::(&text) @@ -78,7 +78,7 @@ async fn upload_archive_buffer( archive_buffer: Vec, archive_hash: &String, ) -> Result<()> { - REQUEST_CLIENT + let response = REQUEST_CLIENT .put(upload_data.upload_url.clone()) .header("Content-Type", "application/gzip") .header("Content-Length", archive_buffer.len()) @@ -87,6 +87,17 @@ async fn upload_archive_buffer( .send() .await?; + if !response.status().is_success() { + let status = response.status(); + let error_text = response.text().await?; + bail!( + "Failed to upload performance report: {}\n -> {} {}", + status, + style("Reason:").bold(), + style(error_text).red() + ); + } + Ok(()) }