From 8f995f80e433d36d706d92d4903957f3145f8f6b Mon Sep 17 00:00:00 2001 From: CosmicHorror Date: Tue, 30 Jul 2024 22:36:12 -0600 Subject: [PATCH] other: Add the config path to the error message if unable to create config (#1515) --- src/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 43370b00..b6e703ab 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,6 +27,7 @@ use std::{ boxed::Box, io::{stderr, stdout, Write}, panic::{self, PanicInfo}, + path::Path, sync::{ mpsc::{self, Receiver, Sender}, Arc, Condvar, Mutex, @@ -331,8 +332,15 @@ fn main() -> anyhow::Result<()> { // Read from config file. let config = { let config_path = get_config_path(args.general.config_location.as_deref()); - get_or_create_config(config_path.as_deref()) - .context("Unable to parse or create the config file.")? + get_or_create_config(config_path.as_deref()).with_context(|| { + format!( + "Unable to parse or create the config file at: {}", + config_path + .as_deref() + .unwrap_or_else(|| Path::new("")) + .display() + ) + })? }; // Create the "app" and initialize a bunch of stuff.