diff --git a/Cargo.toml b/Cargo.toml index 0d41bdbb..3a05685e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -71,7 +71,7 @@ serde = { version = "1.0.180", optional = true } slotmap = "1.0.6" thiserror = "1.0.44" tokio = { version = "1.24.2", optional = true } -tracing = "0.1" +tracing.workspace = true unicode-segmentation = "1.6" url = "2.4.0" zbus = {version = "3.14.1", default-features = false, optional = true} @@ -152,6 +152,7 @@ exclude = ["examples/design-demo", "iced"] [workspace.dependencies] dirs = "5.0.1" +tracing = "0.1" [patch."https://github.com/pop-os/libcosmic"] diff --git a/cosmic-config-derive/Cargo.toml b/cosmic-config-derive/Cargo.toml index 46d79658..0c30cecd 100644 --- a/cosmic-config-derive/Cargo.toml +++ b/cosmic-config-derive/Cargo.toml @@ -9,4 +9,5 @@ proc-macro = true [dependencies] syn = "1.0" -quote = "1.0" \ No newline at end of file +quote = "1.0" +tracing.workspace = true \ No newline at end of file diff --git a/cosmic-config-derive/src/lib.rs b/cosmic-config-derive/src/lib.rs index e1ea70fe..a7c253c5 100644 --- a/cosmic-config-derive/src/lib.rs +++ b/cosmic-config-derive/src/lib.rs @@ -89,11 +89,25 @@ fn impl_cosmic_config_entry_macro(ast: &syn::DeriveInput) -> TokenStream { Some(quote! { #[doc = #doc] /// - /// Returns `Ok(true)` when the field's value has changed and was written to disk - pub fn #setter_name(&mut self, config: &cosmic_config::Config, value: #field_type) -> Result { + /// Returns `Ok(true)` when the field's value has changed and was written to disk. + /// Log error in case of faillure + pub fn #setter_name(&mut self, config: &Option, value: #field_type) -> Result { if self.#field_name != value { self.#field_name = value; - cosmic_config::ConfigSet::set(config, stringify!(#field_name), &self.#field_name)?; + match config { + Some(config) => { + if let Err(err) = cosmic_config::ConfigSet::set(config, stringify!(#field_name), &self.#field_name) { + tracing::error!("failed to save config {:?}: {}", stringify!(#field_name), err); + return Err(err); + } + } + None => { + tracing::error!( + "failed to save config {}: no config handler", + stringify!(#field_name), + ); + } + } Ok(true) } else { Ok(false) diff --git a/cosmic-theme/Cargo.toml b/cosmic-theme/Cargo.toml index 5acc85ab..eaa9b5c6 100644 --- a/cosmic-theme/Cargo.toml +++ b/cosmic-theme/Cargo.toml @@ -27,3 +27,4 @@ csscolorparser = {version = "0.6.2", features = ["serde"]} cosmic-config = { path = "../cosmic-config/", default-features = false, features = ["subscription", "macro"] } dirs.workspace = true thiserror = "1.0.5" +tracing.workspace = true \ No newline at end of file