Skip to content

Commit

Permalink
🐛 Show descriptive error message when not in a git repository
Browse files Browse the repository at this point in the history
semver: patch
  • Loading branch information
Somfic committed Jun 7, 2024
1 parent 63f3316 commit 10b81dc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@ fn main() -> anyhow::Result<()> {
if args.contains(&"tag".to_string()) {
tag()?;
} else {
commit()?;
let result = commit();

if let Err(e) = result {
if e.to_string().contains("Not a git repository") {
println!("Not a git repository.");
} else {
return Err(e);
}
}
}

Ok(())
Expand Down

0 comments on commit 10b81dc

Please sign in to comment.