aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cache/repo_cache.go23
1 files changed, 3 insertions, 20 deletions
diff --git a/cache/repo_cache.go b/cache/repo_cache.go
index 83ce4802..e70904df 100644
--- a/cache/repo_cache.go
+++ b/cache/repo_cache.go
@@ -32,14 +32,6 @@ const identityCacheFile = "identity-cache"
// 3: CreateUnixTime --> createUnixTime, EditUnixTime --> editUnixTime
const formatVersion = 3
-type ErrInvalidCacheFormat struct {
- message string
-}
-
-func (e ErrInvalidCacheFormat) Error() string {
- return e.message
-}
-
var _ repository.RepoCommon = &RepoCache{}
// RepoCache is a cache for a Repository. This cache has multiple functions:
@@ -100,13 +92,8 @@ func NewNamedRepoCache(r repository.ClockedRepo, name string) (*RepoCache, error
if err == nil {
return c, nil
}
- if _, ok := err.(ErrInvalidCacheFormat); !ok {
- // Actual error
- return nil, err
- }
-
- // We have an outdated cache format, rebuilding it.
+ // Cache is either missing, broken or outdated. Rebuilding.
err = c.buildCache()
if err != nil {
return nil, err
@@ -259,9 +246,7 @@ func (c *RepoCache) loadBugCache() error {
}
if aux.Version != formatVersion {
- return ErrInvalidCacheFormat{
- message: fmt.Sprintf("unknown cache format version %v", aux.Version),
- }
+ return fmt.Errorf("unknown cache format version %v", aux.Version)
}
c.bugExcerpts = aux.Excerpts
@@ -291,9 +276,7 @@ func (c *RepoCache) loadIdentityCache() error {
}
if aux.Version != formatVersion {
- return ErrInvalidCacheFormat{
- message: fmt.Sprintf("unknown cache format version %v", aux.Version),
- }
+ return fmt.Errorf("unknown cache format version %v", aux.Version)
}
c.identitiesExcerpts = aux.Excerpts