summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@ifm.com>2022-04-13 14:02:36 +0200
committerMatthias Beyer <matthias.beyer@ifm.com>2022-04-13 14:34:30 +0200
commit443604eb92128c1588a9b162eca78bfd6dbff0c3 (patch)
tree4afad7e6ca766f14e5b85ec00f2a17a986ea481f
parent380a335a3460c6cafa29b92f307dcc6ab4c890d2 (diff)
plugin_httpstop: Adapt for miette as error handling crate
This patch adapts the plugin_httpstop crate for the changes from commit 9ccd86589db8f9a72c4d7f545813e8da40b4d039 ("Replace PluginError with miette::Error") which replaced anyhow with miette. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
-rw-r--r--Cargo.lock2
-rw-r--r--plugins/plugin_httpstop/Cargo.toml2
-rw-r--r--plugins/plugin_httpstop/src/lib.rs4
3 files changed, 4 insertions, 4 deletions
diff --git a/Cargo.lock b/Cargo.lock
index d87bfc74..94b32053 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2020,10 +2020,10 @@ dependencies = [
name = "plugin_httpstop"
version = "0.1.0"
dependencies = [
- "anyhow",
"async-trait",
"hyper",
"log",
+ "miette",
"serde",
"tedge_api",
"tokio",
diff --git a/plugins/plugin_httpstop/Cargo.toml b/plugins/plugin_httpstop/Cargo.toml
index 9167ce3f..3f34eeb3 100644
--- a/plugins/plugin_httpstop/Cargo.toml
+++ b/plugins/plugin_httpstop/Cargo.toml
@@ -6,10 +6,10 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-anyhow = "1"
async-trait = "0.1"
log = { version = "0.4", features = ["serde"] }
serde = { version = "1.0.136", features = ["derive"] }
+miette = "4.4"
tracing = "0.1"
tokio = { version = "1", features = ["rt"] }
tokio-util = "0.7.0"
diff --git a/plugins/plugin_httpstop/src/lib.rs b/plugins/plugin_httpstop/src/lib.rs
index 250d0a03..90996a28 100644
--- a/plugins/plugin_httpstop/src/lib.rs
+++ b/plugins/plugin_httpstop/src/lib.rs
@@ -44,7 +44,7 @@ where
.clone()
.try_into::<HttpStopConfig>()
.map(|_| ())
- .map_err(|_| anyhow::anyhow!("Failed to parse log configuration"))
+ .map_err(|_| miette::miette!("Failed to parse log configuration"))
.map_err(PluginError::from)
}
@@ -58,7 +58,7 @@ where
let config = config
.clone()
.try_into::<HttpStopConfig>()
- .map_err(|_| anyhow::anyhow!("Failed to parse log configuration"))?;
+ .map_err(|_| miette::miette!("Failed to parse log configuration"))?;
let plugin = HttpStopPlugin {
cancellation_token,