Skip to content

Commit

Permalink
feat(errors): Allow checking codeowners file not found (#41)
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
  • Loading branch information
pablochacin authored Sep 27, 2024
1 parent b3a8ae6 commit d659b73
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion codeowners.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import (
"strings"
)

// ErrNoCodeownersFound is returned when no CODEOWNERS file is found
var ErrNoCodeownersFound = errors.New("no CODEOWNERS found")

// Codeowners - patterns/owners mappings for the given repo
type Codeowners struct {
repoRoot string
Expand Down Expand Up @@ -106,7 +109,7 @@ func FromFileWithFS(fsys fs.FS, path string) (*Codeowners, error) {
return nil, err
}
if r == nil {
return nil, fmt.Errorf("no CODEOWNERS found in %s", path)
return nil, fmt.Errorf("%w in %s", ErrNoCodeownersFound, path)
}
return FromReader(r, root)
}
Expand Down

0 comments on commit d659b73

Please sign in to comment.