Skip to content

Commit

Permalink
feat: fatally log error when trying to load cache from files
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Gleich <[email protected]>
  • Loading branch information
gleich committed Dec 5, 2024
1 parent 2fd8f3d commit 6a1fa3f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions internal/cache/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,13 @@ func (c *Cache[T]) loadFromFile() {
if _, err := os.Stat(c.filePath); !os.IsNotExist(err) {
b, err := os.ReadFile(c.filePath)
if err != nil {
lumber.Error(err, "reading from cache file from", c.filePath, "failed")
return
lumber.Fatal(err, "reading from cache file from", c.filePath, "failed")
}

var data cacheData[T]
err = json.Unmarshal(b, &data)
if err != nil {
lumber.Error(err, "unmarshal json data failed from:", string(b))
return
lumber.Fatal(err, "unmarshal json data failed from:", string(b))
}

c.data = data.Data
Expand Down

0 comments on commit 6a1fa3f

Please sign in to comment.