diff options
author | Michael Muré <batolettre@gmail.com> | 2018-09-18 23:36:45 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-09-18 23:36:45 +0200 |
commit | 760d077134a515c2c6f8c693e9fb7eac06429dbf (patch) | |
tree | 17bca869ffcc5200b4afc2fd621dc25bd94e6439 | |
parent | 84555679004dee3b956243750de4f98ba294acf5 (diff) | |
download | git-bug-760d077134a515c2c6f8c693e9fb7eac06429dbf.tar.gz |
cache: don't ignore error when building the cache
-rw-r--r-- | cache/repo_cache.go | 12 |
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) { |