Skip to content

Commit

Permalink
Improve repos file not found error (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
FelicianoTech authored Feb 3, 2023
1 parent 963750f commit 19037bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions warden/cmd/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"log"
"os"
"strings"

Expand Down Expand Up @@ -53,12 +52,12 @@ var (

repoFile, _, err := loadRepositoriesFile(repositoriesFileFl)
if err != nil {
log.Fatal(err)
return err
}

policy, _, err := loadPolicyFile(policyFileFl)
if err != nil {
log.Fatal(err)
return err
}

ghToken := viper.GetString("githubToken")
Expand Down
2 changes: 1 addition & 1 deletion warden/cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func loadRepositoriesFile(customPath string) (*RepositoriesFile, []byte, error)

yamlContent, err = loadYAMLFile("repositories.yml", customPath)
if err != nil {
return nil, nil, fmt.Errorf("A Repositories file was not found. Either './repositories.yml' needs to be used or the '--repositoriesFile' flag set.")
return nil, nil, fmt.Errorf("./repositories.yml' was not found. The file either doesn't exist, you're in the wrong directory, or the '--repositoriesFile' flag needs to be set.")
}

err = yaml.Unmarshal(yamlContent, &repositoriesFile)
Expand Down

0 comments on commit 19037bb

Please sign in to comment.