mirror of
https://codeberg.org/icewind/prometheus-edge-trigger.git
synced 2026-06-03 10:14:12 +02:00
mqtt config error message
This commit is contained in:
parent
eb77fa75bc
commit
3b5798cc2e
1 changed files with 6 additions and 2 deletions
|
|
@ -38,6 +38,8 @@ pub enum TriggerError {
|
||||||
Network(#[error(source)] reqwest::Error),
|
Network(#[error(source)] reqwest::Error),
|
||||||
#[error(display = "{}", _0)]
|
#[error(display = "{}", _0)]
|
||||||
Mqtt(#[error(source)] rumqttc::ClientError),
|
Mqtt(#[error(source)] rumqttc::ClientError),
|
||||||
|
#[error(display = "{}", _0)]
|
||||||
|
Configuration(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TriggerManager {
|
impl TriggerManager {
|
||||||
|
|
@ -180,7 +182,7 @@ async fn run_action(action: &Action, client: &Client, mqtt_config: Option<&MqttC
|
||||||
match (action.method, url, topic, payload) {
|
match (action.method, url, topic, payload) {
|
||||||
(Method::Put, Some(url), _, _) => {
|
(Method::Put, Some(url), _, _) => {
|
||||||
client.put(&url).send().await?;
|
client.put(&url).send().await?;
|
||||||
},
|
}
|
||||||
(Method::Post, Some(url), _, _) => {
|
(Method::Post, Some(url), _, _) => {
|
||||||
client.post(&url).send().await?;
|
client.post(&url).send().await?;
|
||||||
}
|
}
|
||||||
|
|
@ -199,8 +201,10 @@ async fn run_action(action: &Action, client: &Client, mqtt_config: Option<&MqttC
|
||||||
let _ = event_loop.poll().await;
|
let _ = event_loop.poll().await;
|
||||||
}
|
}
|
||||||
}).await;
|
}).await;
|
||||||
|
} else {
|
||||||
|
return Err(TriggerError::Configuration("mqtt trigger configured, but no mqtt server configured".to_string()));
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue