From 6281152a84e6e15be3b53b88d5e4e3cd17549e01 Mon Sep 17 00:00:00 2001 From: Jonathan Strong Date: Wed, 7 Dec 2022 21:19:28 -0500 Subject: [PATCH] improve error reporting when config toml file fails to parse (still a bit meh) --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 9f58f2c..589d373 100644 --- a/src/main.rs +++ b/src/main.rs @@ -381,7 +381,10 @@ async fn load_config_file(config: Config) -> Result { Some(path) => { debug!(?path, "loading config file"); 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) }