From 760d077134a515c2c6f8c693e9fb7eac06429dbf Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Tue, 18 Sep 2018 23:36:45 +0200 Subject: cache: don't ignore error when building the cache --- cache/repo_cache.go | 12 ++++++++++-- 1 file 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) { -- cgit