From 8f34206a95f9caf524473fd3d95beb759e6b78bd Mon Sep 17 00:00:00 2001 From: Eiji Onchi Date: Thu, 8 Nov 2018 19:14:48 +0900 Subject: [PATCH] Print message for missing metadata --- cmd/general.go | 3 ++- cmd/open.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/general.go b/cmd/general.go index 853a6b3..b3878e4 100644 --- a/cmd/general.go +++ b/cmd/general.go @@ -171,7 +171,8 @@ to set the correct path of this library. if dir.IsDir() { d, err := ioutil.ReadFile(filepath.Join(path, dir.Name(), "entry.yaml")) if err != nil { - panic(err) + fmt.Println("Could not find data for:", dir.Name()) + return } var e scholar.Entry if err := yaml.Unmarshal(d, &e); err != nil { diff --git a/cmd/open.go b/cmd/open.go index f5641bc..780c8e2 100644 --- a/cmd/open.go +++ b/cmd/open.go @@ -97,7 +97,8 @@ func entryFromKey(key string) *scholar.Entry { if dir.IsDir() && dir.Name() == strings.TrimSpace(key) { d, err := ioutil.ReadFile(filepath.Join(libraryPath(), dir.Name(), "entry.yaml")) if err != nil { - panic(err) + fmt.Println("Could not find data for:", dir.Name()) + continue } var e scholar.Entry