From 53a65f6c00c1e1fc16356ec59d26102edb2c62dc Mon Sep 17 00:00:00 2001 From: wallrony Date: Fri, 8 Oct 2021 10:45:41 -0300 Subject: [PATCH] Add handling errors in read policies and narratives (#48) --- internal/model/fs.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/model/fs.go b/internal/model/fs.go index 6923e42..5c546c6 100644 --- a/internal/model/fs.go +++ b/internal/model/fs.go @@ -102,6 +102,9 @@ func ReadNarratives() ([]*Document, error) { for _, f := range files { n := &Document{} mdmd, err := loadMDMD(f.FullPath) + if err != nil { + return nil, err + } err = yaml.Unmarshal([]byte(mdmd.yaml), &n) if err != nil { return nil, errors.Wrap(err, "unable to parse "+f.FullPath) @@ -155,7 +158,9 @@ func ReadPolicies() ([]*Document, error) { for _, f := range files { p := &Document{} mdmd, err := loadMDMD(f.FullPath) - + if err != nil { + return nil, err + } err = yaml.Unmarshal([]byte(mdmd.yaml), &p) if err != nil { return nil, errors.Wrap(err, "unable to parse "+f.FullPath)