Skip to content

Commit ab6de53

Browse files
committed
chore(theme): avoid logging errors for unset config parameters
1 parent 7d84d21 commit ab6de53

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/theme/mod.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,11 @@ pub fn subscription(is_dark: bool) -> Subscription<crate::theme::Theme> {
9191
crate::cosmic_theme::Theme::VERSION,
9292
)
9393
.map(|res| {
94-
for err in res.errors {
95-
tracing::error!("{:?}", err);
94+
for error in res.errors.into_iter().filter(cosmic_config::Error::is_err) {
95+
tracing::error!(
96+
?error,
97+
"error while watching system theme preference changes"
98+
);
9699
}
97100

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

107110
let t = crate::cosmic_theme::Theme::get_entry(&helper).unwrap_or_else(|(errors, theme)| {
108-
for err in errors {
109-
tracing::error!("{:?}", err);
111+
for error in errors.into_iter().filter(cosmic_config::Error::is_err) {
112+
tracing::error!(?error, "error loading system dark theme");
110113
}
111114
theme
112115
});
@@ -120,8 +123,8 @@ pub fn system_light() -> Theme {
120123
};
121124

122125
let t = crate::cosmic_theme::Theme::get_entry(&helper).unwrap_or_else(|(errors, theme)| {
123-
for err in errors {
124-
tracing::error!("{:?}", err);
126+
for error in errors.into_iter().filter(cosmic_config::Error::is_err) {
127+
tracing::error!(?error, "error loading system light theme");
125128
}
126129
theme
127130
});

0 commit comments

Comments
 (0)