diff options
Diffstat (limited to 'internal/cardart')
| -rw-r--r-- | internal/cardart/store.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/cardart/store.go b/internal/cardart/store.go index 7e9b263..1a3621f 100644 --- a/internal/cardart/store.go +++ b/internal/cardart/store.go @@ -3,6 +3,7 @@ package cardart import ( + "fmt" "os" "gopkg.in/yaml.v3" @@ -15,9 +16,15 @@ type Store struct { func Load(path string) *Store { store := &Store{Cards: make(map[string]map[int][]string)} data, err := os.ReadFile(path) - if err != nil || yaml.Unmarshal(data, store) != nil { + if err != nil { + if !os.IsNotExist(err) { + fmt.Fprintf(os.Stderr, "cardart: read %s: %v\n", path, err) + } return store } + if err := yaml.Unmarshal(data, store); err != nil { + fmt.Fprintf(os.Stderr, "cardart: parse %s: %v\n", path, err) + } return store } |
