summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@atos.net>2021-03-11 08:22:46 +0100
committerMatthias Beyer <matthias.beyer@atos.net>2021-03-11 08:22:46 +0100
commita282aa78f8ef025cc4d870788a5e7e8ae623f57a (patch)
tree74d66c952632228ab017135851e4890d10dc2a6e
parent9c8f67a3101d67b5477c02a5776cb2c29f6daba1 (diff)
Add more error context
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
-rw-r--r--src/main.rs7
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)
};