Skip to content

Commit

Permalink
add logging if config can't be parsed
Browse files Browse the repository at this point in the history
  • Loading branch information
TornaxO7 committed Feb 13, 2024
1 parent b1ad7c5 commit 0f911de
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand All @@ -13,7 +13,10 @@ pub struct Config {
impl Config {
pub fn load<P: AsRef<Path>>(path: P) -> anyhow::Result<Self> {
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 {}: {}",
Expand Down

0 comments on commit 0f911de

Please sign in to comment.