diff options
author | Matthias Beyer <matthias.beyer@atos.net> | 2021-03-11 08:22:46 +0100 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@atos.net> | 2021-03-11 08:22:46 +0100 |
commit | a282aa78f8ef025cc4d870788a5e7e8ae623f57a (patch) | |
tree | 74d66c952632228ab017135851e4890d10dc2a6e /src/main.rs | |
parent | 9c8f67a3101d67b5477c02a5776cb2c29f6daba1 (diff) |
Add more error context
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 9cfdfe2..bb5dd88 100644 --- a/src/main.rs +++ b/src/main.rs @@ -87,7 +87,9 @@ async fn main() -> Result<()> { let app = cli::cli(); let cli = app.get_matches(); - let repo = git2::Repository::discover(PathBuf::from("."))?; + let repo = git2::Repository::discover(PathBuf::from(".")) + .context("Loading the git repository") + .context("Butido must be executed within the package repository")?; let repo_path = repo .workdir() .ok_or_else(|| anyhow!("Not a repository with working directory. Cannot do my job!"))?; @@ -109,7 +111,8 @@ async fn main() -> Result<()> { let load_repo = || -> Result<Repository> { let bar = progressbars.bar(); - let repo = Repository::load(&repo_path, &bar)?; + let repo = Repository::load(&repo_path, &bar) + .context("Loading the repository")?; bar.finish_with_message("Repository loading finished"); Ok(repo) }; |