Skip to content

Commit

Permalink
chore(theme): avoid logging errors for unset config parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
mmstick committed Feb 19, 2025
1 parent 7d84d21 commit ab6de53
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/theme/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@ pub fn subscription(is_dark: bool) -> Subscription<crate::theme::Theme> {
crate::cosmic_theme::Theme::VERSION,
)
.map(|res| {
for err in res.errors {
tracing::error!("{:?}", err);
for error in res.errors.into_iter().filter(cosmic_config::Error::is_err) {
tracing::error!(
?error,
"error while watching system theme preference changes"
);
}

Theme::system(Arc::new(res.config))
Expand All @@ -105,8 +108,8 @@ pub fn system_dark() -> Theme {
};

let t = crate::cosmic_theme::Theme::get_entry(&helper).unwrap_or_else(|(errors, theme)| {
for err in errors {
tracing::error!("{:?}", err);
for error in errors.into_iter().filter(cosmic_config::Error::is_err) {
tracing::error!(?error, "error loading system dark theme");
}
theme
});
Expand All @@ -120,8 +123,8 @@ pub fn system_light() -> Theme {
};

let t = crate::cosmic_theme::Theme::get_entry(&helper).unwrap_or_else(|(errors, theme)| {
for err in errors {
tracing::error!("{:?}", err);
for error in errors.into_iter().filter(cosmic_config::Error::is_err) {
tracing::error!(?error, "error loading system light theme");
}
theme
});
Expand Down

0 comments on commit ab6de53

Please sign in to comment.