1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-18 07:11: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:
Jake Stanger 2023-05-20 14:36:04 +01:00
parent 960da55a05
commit 87ca399220
7 changed files with 52 additions and 62 deletions

View file

@ -11,7 +11,7 @@ use gtk::Label;
use serde::Deserialize;
use tokio::spawn;
use tokio::sync::mpsc::{Receiver, Sender};
use tracing::{debug, error};
use tracing::debug;
#[derive(Debug, Deserialize, Clone)]
pub struct FocusedModule {
@ -113,11 +113,8 @@ impl Module<gtk::Box> for FocusedModule {
let icon_theme = icon_theme.clone();
context.widget_rx.attach(None, move |(name, id)| {
if self.show_icon {
if let Err(err) = ImageProvider::parse(&id, &icon_theme, self.icon_size)
.and_then(|image| image.load_into_image(icon.clone()))
{
error!("{err:?}");
}
ImageProvider::parse(&id, &icon_theme, self.icon_size)
.map(|image| image.load_into_image(icon.clone()));
}
if self.show_title {