diff --git a/src/icon/icon_info.rs b/src/icon/icon_info.rs index 17c4192..071c886 100644 --- a/src/icon/icon_info.rs +++ b/src/icon/icon_info.rs @@ -125,7 +125,13 @@ impl IconInfo { }; } - let res = CLIENT.get(url).headers(headers).send().await?; + let res = CLIENT + .get(url) + .headers(headers) + .send() + .await? + .error_for_status()?; + if !res.status().is_success() { return Err("failed to fetch".into()); }; diff --git a/src/manifest.rs b/src/manifest.rs index 58b4c61..ba773f0 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -34,6 +34,8 @@ async fn load_manifest_cached(url: Url) -> Result, String> { .send() .await .map_err(|e| format!("{}: {:?}", url, e))? + .error_for_status() + .map_err(|e| format!("{}: {:?}", url, e))? .json() .await .map_err(|e| format!("{}: {:?}", url, e))?;