From 189784f5fd0b58345cd397a69310d776dcee3e52 Mon Sep 17 00:00:00 2001 From: Julia Date: Mon, 10 Apr 2023 16:45:15 -0400 Subject: [PATCH] In the case of Github release deserialize error, log response text Co-Authored-By: Joseph Lyons --- crates/util/src/github.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/crates/util/src/github.rs b/crates/util/src/github.rs index 5170bd6f4f..3bb4baa293 100644 --- a/crates/util/src/github.rs +++ b/crates/util/src/github.rs @@ -9,13 +9,13 @@ pub struct GitHubLspBinaryVersion { pub url: String, } -#[derive(Deserialize)] +#[derive(Deserialize, Debug)] pub struct GithubRelease { pub name: String, pub assets: Vec, } -#[derive(Deserialize)] +#[derive(Deserialize, Debug)] pub struct GithubReleaseAsset { pub name: String, pub browser_download_url: String, @@ -40,7 +40,13 @@ pub async fn latest_github_release( .await .context("error reading latest release")?; - let release: GithubRelease = - serde_json::from_slice(body.as_slice()).context("error deserializing latest release")?; - Ok(release) + let release = serde_json::from_slice::(body.as_slice()); + if release.is_err() { + log::error!( + "Github API response text: {:?}", + String::from_utf8_lossy(body.as_slice()) + ); + } + + release.context("error deserializing latest release") }