From 6a1fa3f5bbb8c295191e4a52ea7ff2cdd5d72233 Mon Sep 17 00:00:00 2001 From: Matt Gleich Date: Thu, 5 Dec 2024 16:27:50 -0500 Subject: [PATCH] feat: fatally log error when trying to load cache from files Signed-off-by: Matt Gleich --- internal/cache/storage.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/cache/storage.go b/internal/cache/storage.go index d1c4840..4a737e8 100644 --- a/internal/cache/storage.go +++ b/internal/cache/storage.go @@ -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