From 6ed1f5d82b2258b16a118eec5b6c862ed0cba7d2 Mon Sep 17 00:00:00 2001 From: Tarek Date: Thu, 19 Oct 2023 21:29:09 +0300 Subject: [PATCH] feat(cmd): improve error message The error message displayed in case of a missing Core Lightning configuration file has been enhanced to provide users with more friendly and actionable information. Now, when coffee fails to find the configuration file at the specified path, it advises users to resolve the issue by running the coffee setup command, helping them quickly address the problem and proceed smoothly. Signed-off-by: Tarek --- coffee_core/src/coffee.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/coffee_core/src/coffee.rs b/coffee_core/src/coffee.rs index 6b087799..68831b45 100644 --- a/coffee_core/src/coffee.rs +++ b/coffee_core/src/coffee.rs @@ -201,8 +201,17 @@ impl CoffeeManager { let path = self.config.cln_config_path.clone().unwrap(); let mut file = CLNConf::new(path.clone(), true); log::info!("looking for the cln config: {path}"); - file.parse() - .map_err(|err| CoffeeError::new(err.core, &err.cause))?; + file.parse().map_err(|err| { + CoffeeError::new( + err.core, + format!( + "coffee was unable to locate Core Lightning configuration file at the specified path: {}. + To resolve this, please run the following command: coffee setup .", + path + ) + .as_str(), + ) + })?; log::trace!("{:?}", file.fields); self.cln_config = Some(file); Ok(())