Show a warning if there's a problem with UCI

This commit is contained in:
Nils Andreas Svee committed 2022-09-28 23:19:12 +02:00
1 parent 431f578460
commit 603acdb7cc
1 file changed
+9 -1
+9 -1
View File
@@ -1,4 +1,6 @@
use crate::error::{ConfigParseError, InvalidMeasurementTypeError, MissingConfigError}; use crate::error::{ConfigParseError, InvalidMeasurementTypeError, MissingConfigError};
#[cfg(feature = "uci")]
use log::warn;
use log::Level; use log::Level;
#[cfg(feature = "uci")] #[cfg(feature = "uci")]
use rust_uci::Uci; use rust_uci::Uci;
@@ -213,7 +215,13 @@ impl Config {
#[cfg(feature = "uci")] #[cfg(feature = "uci")]
fn get_from_uci(key: &str) -> Option<String> { fn get_from_uci(key: &str) -> Option<String> {
let mut uci: Uci = Uci::new()?; let mut uci = match Uci::new() {
Ok(val) => val,
Err(e) => {
warn!("Error opening UCI instance: {}", e);
return None;
}
};
return match uci.get(key) { return match uci.get(key) {
Ok(val) => Some(val), Ok(val) => Some(val),