From 5edbb58b7cfd9a23bf934284151a746883c2c951 Mon Sep 17 00:00:00 2001 From: TornaxO7 Date: Sun, 11 Feb 2024 13:10:04 +0100 Subject: [PATCH] add logging if config can't be parsed --- src/config.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index ee18893..2875ca4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,7 +1,7 @@ use std::path::Path; use serde::{Deserialize, Serialize}; -use tracing::warn; +use tracing::{error, warn}; #[derive(Debug, Default, Serialize, Deserialize)] #[serde(default)] @@ -13,7 +13,10 @@ pub struct Config { impl Config { pub fn load>(path: P) -> anyhow::Result { match std::fs::read_to_string(&path) { - Ok(content) => toml::from_str(&content).map_err(|e| e.into()), + Ok(content) => toml::from_str(&content).map_err(|e| { + error!("Couldn't parse config file: {}", e); + e.into() + }), Err(e) => { warn!( "Couldn't read config file at {}: {}",