Browse Source

improve error reporting when config toml file fails to parse (still a bit meh)

master
Jonathan Strong 2 years ago
parent
commit
6281152a84
  1. 5
      src/main.rs

5
src/main.rs

@ -381,7 +381,10 @@ async fn load_config_file(config: Config) -> Result<Config, AnyError> {
Some(path) => { Some(path) => {
debug!(?path, "loading config file"); debug!(?path, "loading config file");
let toml = tokio::fs::read_to_string(&path).await?; let toml = tokio::fs::read_to_string(&path).await?;
let config: Config = toml::from_str(&toml)?; let config: Config = match toml::from_str(&toml) {
Ok(c) => c,
Err(e) => panic!("\nfatal error: parsing config file at {} failed:\n\n{}\n\n", path.display(), e),
};
Ok(config) Ok(config)
} }

Loading…
Cancel
Save