diff options
-rw-r--r-- | Cargo.toml | 3 | ||||
-rw-r--r-- | crates/core/tedge_core/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/core/tedge_core/src/errors.rs | 40 | ||||
-rw-r--r-- | tedge/invalid-config.toml | 38 |
4 files changed, 49 insertions, 34 deletions
@@ -25,6 +25,3 @@ codegen-units = 1 lto = true opt-level = "z" panic = 'abort' - -# [patch.crates-io] -# miette = { path = "../private/miette/", version = "4.4" } diff --git a/crates/core/tedge_core/Cargo.toml b/crates/core/tedge_core/Cargo.toml index 0a3e8103..9656a3a1 100644 --- a/crates/core/tedge_core/Cargo.toml +++ b/crates/core/tedge_core/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] async-trait = "0.1.52" -miette = "4.4" +miette = "4.7" futures = "0.3" serde = { version = "1.0.136", features = ["derive"] } thiserror = "1.0.30" diff --git a/crates/core/tedge_core/src/errors.rs b/crates/core/tedge_core/src/errors.rs index ccf4a76e..ac7d518b 100644 --- a/crates/core/tedge_core/src/errors.rs +++ b/crates/core/tedge_core/src/errors.rs @@ -87,12 +87,8 @@ pub struct PluginConfigVerificationError { } impl miette::Diagnostic for PluginConfigVerificationError { - fn related<'a>(&'a self) -> Option<Box<dyn Iterator<Item = &'a dyn miette::Diagnostic> + 'a>> { - Some(Box::new(std::iter::once_with(|| { - let err: &dyn miette::Diagnostic = &*self.error; - - err - }))) + fn diagnostic_source(&self) -> Option<&dyn miette::Diagnostic> { + Some(&*self.error) } } @@ -127,12 +123,8 @@ pub struct PluginBuilderInstantiationError { } impl miette::Diagnostic for PluginBuilderInstantiationError { - fn related<'a>(&'a self) -> Option<Box<dyn Iterator<Item = &'a dyn miette::Diagnostic> + 'a>> { - Some(Box::new(std::iter::once_with(|| { - let err: &dyn miette::Diagnostic = &*self.error; - - err - }))) + fn diagnostic_source(&self) -> Option<&dyn miette::Diagnostic> { + Some(&*self.error) } } @@ -181,12 +173,8 @@ pub struct PluginStartFailed { } impl miette::Diagnostic for PluginStartFailed { - fn related<'a>(&'a self) -> Option<Box<dyn Iterator<Item = &'a dyn miette::Diagnostic> + 'a>> { - Some(Box::new(std::iter::once_with(|| { - let err: &dyn miette::Diagnostic = &*self.error; - - err - }))) + fn diagnostic_source(&self) -> Option<&dyn miette::Diagnostic> { + Some(&*self.error) } } @@ -229,12 +217,8 @@ pub struct PluginMessageHandlerFailed { } impl miette::Diagnostic for PluginMessageHandlerFailed { - fn related<'a>(&'a self) -> Option<Box<dyn Iterator<Item = &'a dyn miette::Diagnostic> + 'a>> { - Some(Box::new(std::iter::once_with(|| { - let err: &dyn miette::Diagnostic = &*self.error; - - err - }))) + fn diagnostic_source(&self) -> Option<&dyn miette::Diagnostic> { + Some(&*self.error) } } @@ -259,11 +243,7 @@ pub struct PluginStopFailed { } impl miette::Diagnostic for PluginStopFailed { - fn related<'a>(&'a self) -> Option<Box<dyn Iterator<Item = &'a dyn miette::Diagnostic> + 'a>> { - Some(Box::new(std::iter::once_with(|| { - let err: &dyn miette::Diagnostic = &*self.error; - - err - }))) + fn diagnostic_source(&self) -> Option<&dyn miette::Diagnostic> { + Some(&*self.error) } } diff --git a/tedge/invalid-config.toml b/tedge/invalid-config.toml new file mode 100644 index 00000000..2113f7ad --- /dev/null +++ b/tedge/invalid-config.toml @@ -0,0 +1,38 @@ +communication_buffer_size = 10 + +plugin_shutdown_timeout_ms = 10000 + +[plugins.logging] +kind = "log" + +[plugins.logging.configuration] +name = "logging" +level = "trace" +acknowledge = false +setup_logger = false + +[plugins.syscpu] +kind = "sysinfo" + +[plugins.syscpu.configuration.cpu] +send_to = ["syscpu"] +interval_ms = 1 + +[plugins.syscpu.configuration.cpu.report_global_processor_info] +enable = true +frequency = true +cpu_usage = true +name = true +vendor_id = true +brand = true + +[plugins.syscpu.configuration.cpu.report_processor_info] +enable = false +frequency = false +cpu_usage = false +name = false +vendor_id = false +brand = false + +[plugins.syscpu.configuration.cpu.report_physical_core_count] +enable = true |