mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-03 11:41:04 +02:00
fix: poor error handling for missing images
Previously images that could not be located were handled by throwing a full report error, which incorrectly stated it was an invalid image *type*. This changes the image handling to instead log a single-line warning directly in the image provider code, reducing the error handling required by each consumer. Resolves #146.
This commit is contained in:
parent
960da55a05
commit
87ca399220
7 changed files with 52 additions and 62 deletions
|
@ -342,19 +342,15 @@ impl Module<Button> for MusicModule {
|
|||
let new_cover = update.song.cover_path;
|
||||
if prev_cover != new_cover {
|
||||
prev_cover = new_cover.clone();
|
||||
let res = match new_cover.map(|cover_path| {
|
||||
let res = if let Some(image) = new_cover.and_then(|cover_path| {
|
||||
ImageProvider::parse(&cover_path, &icon_theme, image_size)
|
||||
}) {
|
||||
Some(Ok(image)) => image.load_into_image(album_image.clone()),
|
||||
Some(Err(err)) => {
|
||||
album_image.set_from_pixbuf(None);
|
||||
Err(err)
|
||||
}
|
||||
None => {
|
||||
album_image.set_from_pixbuf(None);
|
||||
Ok(())
|
||||
}
|
||||
image.load_into_image(album_image.clone())
|
||||
} else {
|
||||
album_image.set_from_pixbuf(None);
|
||||
Ok(())
|
||||
};
|
||||
|
||||
if let Err(err) = res {
|
||||
error!("{err:?}");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue