mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-28 15:44:20 +03:00
Improve error messages when fetching single GitHub release (#9219)
Release Notes: - N/A
This commit is contained in:
parent
e103607134
commit
9f396948bb
@ -85,14 +85,19 @@ pub async fn github_release_with_tag(
|
||||
let mut response = http
|
||||
.get(&url, Default::default(), true)
|
||||
.await
|
||||
.context("error fetching latest release")?;
|
||||
.with_context(|| format!("error fetching release {} of {}", tag, repo_name_with_owner))?;
|
||||
|
||||
let mut body = Vec::new();
|
||||
response
|
||||
.body_mut()
|
||||
.read_to_end(&mut body)
|
||||
.await
|
||||
.context("error reading latest release")?;
|
||||
.with_context(|| {
|
||||
format!(
|
||||
"error reading response body for release {} of {}",
|
||||
tag, repo_name_with_owner
|
||||
)
|
||||
})?;
|
||||
|
||||
if response.status().is_client_error() {
|
||||
let text = String::from_utf8_lossy(body.as_slice());
|
||||
@ -111,7 +116,11 @@ pub async fn github_release_with_tag(
|
||||
"GitHub API response text: {:?}",
|
||||
String::from_utf8_lossy(body.as_slice())
|
||||
);
|
||||
return Err(anyhow!("error deserializing latest release"));
|
||||
Err(anyhow!(
|
||||
"error deserializing release {} of {}",
|
||||
tag,
|
||||
repo_name_with_owner
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user