Skip to content

Commit 50fbc95

Browse files
committed
Display cache error
1 parent dcb86f2 commit 50fbc95

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

api/src/cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub(crate) async fn get(url: &str) -> oxfeed::Result<Vec<u8>> {
1010

1111
content
1212
} else {
13-
use std::io::Write;
13+
use std::io::Write as _;
1414

1515
let content = reqwest::get(url).await?.bytes().await?;
1616
std::fs::create_dir_all(path.parent().unwrap())?;

api/src/services/icon.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ pub(crate) fn scope() -> actix_web::Scope {
99

1010
#[actix_web::get("/{url:.*}")]
1111
async fn icon(url: actix_web::web::Path<String>) -> oxfeed::Result<actix_web::HttpResponse> {
12-
use base64::Engine;
12+
use base64::Engine as _;
1313

1414
let url = base64::engine::general_purpose::STANDARD.decode(url.into_inner())?;
1515
let icon = String::from_utf8(url)?;
1616

1717
let body = match crate::cache::get(&icon).await {
1818
Ok(body) => body,
19-
Err(_) => EMPTY_IMG.to_vec(),
19+
Err(err) => {
20+
log::error!("Unable to get icon: {err}");
21+
EMPTY_IMG.to_vec()
22+
}
2023
};
2124

2225
let mut mime = tree_magic_mini::from_u8(&body);

0 commit comments

Comments
 (0)