mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 05:15:00 +00:00
Merge pull request #2367 from zed-industries/log-github-api-response-for-deserialize-error
In the case of Github release deserialize error, log response text
This commit is contained in:
commit
0e4de87e0e
1 changed files with 11 additions and 5 deletions
|
@ -9,13 +9,13 @@ pub struct GitHubLspBinaryVersion {
|
||||||
pub url: String,
|
pub url: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize, Debug)]
|
||||||
pub struct GithubRelease {
|
pub struct GithubRelease {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub assets: Vec<GithubReleaseAsset>,
|
pub assets: Vec<GithubReleaseAsset>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize, Debug)]
|
||||||
pub struct GithubReleaseAsset {
|
pub struct GithubReleaseAsset {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub browser_download_url: String,
|
pub browser_download_url: String,
|
||||||
|
@ -40,7 +40,13 @@ pub async fn latest_github_release(
|
||||||
.await
|
.await
|
||||||
.context("error reading latest release")?;
|
.context("error reading latest release")?;
|
||||||
|
|
||||||
let release: GithubRelease =
|
let release = serde_json::from_slice::<GithubRelease>(body.as_slice());
|
||||||
serde_json::from_slice(body.as_slice()).context("error deserializing latest release")?;
|
if release.is_err() {
|
||||||
Ok(release)
|
log::error!(
|
||||||
|
"Github API response text: {:?}",
|
||||||
|
String::from_utf8_lossy(body.as_slice())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
release.context("error deserializing latest release")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue