mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-07 11:11:30 +00:00
Improve error messages when fetching single GitHub release (#9219)
Release Notes: - N/A
This commit is contained in:
parent
e103607134
commit
9f396948bb
1 changed files with 12 additions and 3 deletions
|
@ -85,14 +85,19 @@ pub async fn github_release_with_tag(
|
||||||
let mut response = http
|
let mut response = http
|
||||||
.get(&url, Default::default(), true)
|
.get(&url, Default::default(), true)
|
||||||
.await
|
.await
|
||||||
.context("error fetching latest release")?;
|
.with_context(|| format!("error fetching release {} of {}", tag, repo_name_with_owner))?;
|
||||||
|
|
||||||
let mut body = Vec::new();
|
let mut body = Vec::new();
|
||||||
response
|
response
|
||||||
.body_mut()
|
.body_mut()
|
||||||
.read_to_end(&mut body)
|
.read_to_end(&mut body)
|
||||||
.await
|
.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() {
|
if response.status().is_client_error() {
|
||||||
let text = String::from_utf8_lossy(body.as_slice());
|
let text = String::from_utf8_lossy(body.as_slice());
|
||||||
|
@ -111,7 +116,11 @@ pub async fn github_release_with_tag(
|
||||||
"GitHub API response text: {:?}",
|
"GitHub API response text: {:?}",
|
||||||
String::from_utf8_lossy(body.as_slice())
|
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 a new issue