1
0
mirror of https://github.com/strongdm/comply synced 2024-07-05 08:11:48 +00:00

Add handling errors in read policies and narratives (#48)

This commit is contained in:
wallrony 2021-10-08 10:45:41 -03:00
parent 373e7737ab
commit 53a65f6c00

View File

@ -102,6 +102,9 @@ func ReadNarratives() ([]*Document, error) {
for _, f := range files { for _, f := range files {
n := &Document{} n := &Document{}
mdmd, err := loadMDMD(f.FullPath) mdmd, err := loadMDMD(f.FullPath)
if err != nil {
return nil, err
}
err = yaml.Unmarshal([]byte(mdmd.yaml), &n) err = yaml.Unmarshal([]byte(mdmd.yaml), &n)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "unable to parse "+f.FullPath) return nil, errors.Wrap(err, "unable to parse "+f.FullPath)
@ -155,7 +158,9 @@ func ReadPolicies() ([]*Document, error) {
for _, f := range files { for _, f := range files {
p := &Document{} p := &Document{}
mdmd, err := loadMDMD(f.FullPath) mdmd, err := loadMDMD(f.FullPath)
if err != nil {
return nil, err
}
err = yaml.Unmarshal([]byte(mdmd.yaml), &p) err = yaml.Unmarshal([]byte(mdmd.yaml), &p)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "unable to parse "+f.FullPath) return nil, errors.Wrap(err, "unable to parse "+f.FullPath)