fix: error_for_status
This commit is contained in:
parent
0dc5df6ccb
commit
4b634e8c3b
2 changed files with 9 additions and 1 deletions
|
@ -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() {
|
if !res.status().is_success() {
|
||||||
return Err("failed to fetch".into());
|
return Err("failed to fetch".into());
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,6 +34,8 @@ async fn load_manifest_cached(url: Url) -> Result<Vec<Icon>, String> {
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
.map_err(|e| format!("{}: {:?}", url, e))?
|
.map_err(|e| format!("{}: {:?}", url, e))?
|
||||||
|
.error_for_status()
|
||||||
|
.map_err(|e| format!("{}: {:?}", url, e))?
|
||||||
.json()
|
.json()
|
||||||
.await
|
.await
|
||||||
.map_err(|e| format!("{}: {:?}", url, e))?;
|
.map_err(|e| format!("{}: {:?}", url, e))?;
|
||||||
|
|
Reference in a new issue