aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-09-18 23:36:45 +0200
committerMichael Muré <batolettre@gmail.com>2018-09-18 23:36:45 +0200
commit760d077134a515c2c6f8c693e9fb7eac06429dbf (patch)
tree17bca869ffcc5200b4afc2fd621dc25bd94e6439
parent84555679004dee3b956243750de4f98ba294acf5 (diff)
downloadgit-bug-760d077134a515c2c6f8c693e9fb7eac06429dbf.tar.gz
cache: don't ignore error when building the cache
-rw-r--r--cache/repo_cache.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/cache/repo_cache.go b/cache/repo_cache.go
index 720857ce..de8b0fa9 100644
--- a/cache/repo_cache.go
+++ b/cache/repo_cache.go
@@ -47,7 +47,10 @@ func NewRepoCache(r repository.Repo) (*RepoCache, error) {
return c, nil
}
- c.buildCache()
+ err = c.buildCache()
+ if err != nil {
+ return nil, err
+ }
return c, c.write()
}
@@ -161,7 +164,7 @@ func cacheFilePath(repo repository.Repo) string {
return path.Join(repo.GetPath(), ".git", "git-bug", cacheFile)
}
-func (c *RepoCache) buildCache() {
+func (c *RepoCache) buildCache() error {
fmt.Printf("Building bug cache... ")
c.excerpts = make(map[string]*BugExcerpt)
@@ -169,11 +172,16 @@ func (c *RepoCache) buildCache() {
allBugs := bug.ReadAllLocalBugs(c.repo)
for b := range allBugs {
+ if b.Err != nil {
+ return b.Err
+ }
+
snap := b.Bug.Compile()
c.excerpts[b.Bug.Id()] = NewBugExcerpt(b.Bug, &snap)
}
fmt.Println("Done.")
+ return nil
}
func (c *RepoCache) ResolveBug(id string) (*BugCache, error) {