Skip to content

Commit f48f5ee

Browse files
committed
Fail if errata path provided does not exist
1 parent f48dea9 commit f48f5ee

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

matter/spec/option.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,20 @@ func (po *ParserOptions) AfterApply() error {
5050
if !exists {
5151
return fmt.Errorf("spec root \"%s\" does not exist", po.Root)
5252
}
53-
if po.ErrataPath != "" && !filepath.IsAbs(po.ErrataPath) {
54-
po.ErrataPath, err = filepath.Abs(po.ErrataPath)
53+
if po.ErrataPath != "" {
54+
if !filepath.IsAbs(po.ErrataPath) {
55+
po.ErrataPath, err = filepath.Abs(po.ErrataPath)
56+
if err != nil {
57+
return err
58+
}
59+
}
60+
exists, err = files.Exists(po.ErrataPath)
5561
if err != nil {
5662
return err
5763
}
64+
if !exists {
65+
return fmt.Errorf("errata path \"%s\" does not exist", po.ErrataPath)
66+
}
5867
}
5968
return nil
6069
}

0 commit comments

Comments
 (0)