summaryrefslogtreecommitdiffstats
path: root/crates/core/tedge_api/examples/heartbeat.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/core/tedge_api/examples/heartbeat.rs')
-rw-r--r--crates/core/tedge_api/examples/heartbeat.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/crates/core/tedge_api/examples/heartbeat.rs b/crates/core/tedge_api/examples/heartbeat.rs
index 35ac183d..8806e726 100644
--- a/crates/core/tedge_api/examples/heartbeat.rs
+++ b/crates/core/tedge_api/examples/heartbeat.rs
@@ -35,6 +35,12 @@ impl Message for HeartbeatStatus {
#[derive(Debug)]
struct HeartbeatServiceBuilder;
+#[derive(miette::Diagnostic, thiserror::Error, Debug)]
+enum HeartbeatBuildError {
+ #[error(transparent)]
+ TomlParse(#[from] toml::de::Error),
+}
+
#[async_trait]
impl<PD: PluginDirectory> PluginBuilder<PD> for HeartbeatServiceBuilder {
fn kind_name() -> &'static str {
@@ -64,7 +70,8 @@ impl<PD: PluginDirectory> PluginBuilder<PD> for HeartbeatServiceBuilder {
where
PD: 'async_trait,
{
- let hb_config: HeartbeatConfig = toml::Value::try_into(config)?;
+ let hb_config: HeartbeatConfig =
+ toml::Value::try_into(config).map_err(HeartbeatBuildError::from)?;
let monitored_services = hb_config
.plugins
.iter()