summaryrefslogtreecommitdiffstats
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/core/tedge_core/Cargo.toml2
-rw-r--r--crates/core/tedge_core/src/errors.rs40
2 files changed, 11 insertions, 31 deletions
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)
}
}