Skip to content

Commit

Permalink
More specific error handling and better messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
leosunmo committed Mar 2, 2023
1 parent 4c7ef3d commit 5721f93
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,14 @@ func main() {
}
if hr.Name() == plumbing.HEAD {
branch, err = getCurrentBranchFromDetachedHead(r)
if err != nil {
log.Fatalf("Failed to get current branch from detached head at %q in directory %s, err %s\n", hr.Hash().String()[:8], path, err.Error())
}
} else {
branch, err = getCurrentBranchFromRepository(r)
}
if err != nil {
log.Fatalf("Failed to get current branch from %s, err %s\n", path, err.Error())
if err != nil {
log.Fatalf("Failed to get current branch from %q in directory %s, err %s\n", hr.Name().Short(), path, err.Error())
}
}
}

Expand Down

0 comments on commit 5721f93

Please sign in to comment.