Skip to content

Commit

Permalink
feat(cmd): improve error message
Browse files Browse the repository at this point in the history
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 <cln_path> command, helping them quickly address the problem and proceed smoothly.

Signed-off-by: Tarek <tareknaser360@gmail.com>
  • Loading branch information
tareknaser committed Oct 19, 2023
1 parent f59756b commit 6ed1f5d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions coffee_core/src/coffee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <cln_path>.",
path
)
.as_str(),
)
})?;
log::trace!("{:?}", file.fields);
self.cln_config = Some(file);
Ok(())
Expand Down

0 comments on commit 6ed1f5d

Please sign in to comment.