Skip to content

Commit

Permalink
Merge pull request #4898 from wasmerio/package-download-more-logging
Browse files Browse the repository at this point in the history
chore: More logging during package downloads
  • Loading branch information
syrusakbary authored Jul 3, 2024
2 parents 461e9ff + e40508c commit 5f19065
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/wasix/src/runtime/package_loader/builtin_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl BuiltinPackageLoader {
options: Default::default(),
};

tracing::debug!(%request.url, %request.method, "Downloading a webc file");
tracing::debug!(%request.url, %request.method, "webc_package_download_start");
tracing::trace!(?request.headers);

let response = self.client.request(request).await?;
Expand All @@ -154,15 +154,18 @@ impl BuiltinPackageLoader {
"Received a response",
);

let url = &dist.webc;
if !response.is_ok() {
let url = &dist.webc;
return Err(crate::runtime::resolver::utils::http_error(&response)
.context(format!("The GET request to \"{url}\" failed")));
return Err(
crate::runtime::resolver::utils::http_error(&response).context(format!(
"package download failed: GET request to \"{}\" failed with status {}",
url, response.status
)),
);
}

let body = response
.body
.context("The response didn't contain a body")?;
let body = response.body.context("package download failed")?;
tracing::debug!(%url, "package_download_succeeded");

Ok(body.into())
}
Expand Down

0 comments on commit 5f19065

Please sign in to comment.