Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
util: Improve error message for failing requests to GH. (#3159)
Piotr Osiewiczbc3572f80e88
diff --git a/crates/util/src/github.rs b/crates/util/src/github.rsindex a3df4c996be..e4b316e12d5 100644--- a/crates/util/src/github.rs+++ b/crates/util/src/github.rs@@ -1,5 +1,5 @@use crate::http::HttpClient;-use anyhow::{anyhow, Context, Result};+use anyhow::{anyhow, bail, Context, Result};use futures::AsyncReadExt;use serde::Deserialize;use std::sync::Arc;@@ -46,6 +46,14 @@ pub async fn latest_github_release(.await.context("error reading latest release")?;+ if response.status().is_client_error() {+ let text = String::from_utf8_lossy(body.as_slice());+ bail!(+ "status error {}, response: {text:?}",+ response.status().as_u16()+ );+ }+let releases = match serde_json::from_slice::<Vec<GithubRelease>>(body.as_slice()) {Ok(releases) => releases,