Skip to content

Commit

Permalink
more detailed error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
aine-etke committed Aug 15, 2024
1 parent 1d54945 commit 2d00c23
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions internal/parser/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func ParseFile(path string) (main, additional models.File) {
fileb, err := os.ReadFile(path)
if err != nil {
utils.Log("ERROR:", err)
utils.Log("ERROR: reading file", path, err)
return models.File{}, models.File{}
}
var req models.File
Expand All @@ -23,7 +23,7 @@ func ParseFile(path string) (main, additional models.File) {
if err := yaml.Unmarshal(fileb, &reqMap); err == nil {
req = reqMap.Slice()
} else {
utils.Log("ERROR:", err)
utils.Log("ERROR: unmarshalling yaml", err)
}
}
req.Sort()
Expand Down Expand Up @@ -65,12 +65,12 @@ func UpdateFile(entries models.File, requirementsPath string) {

outb, err := yaml.Marshal(entries)
if err != nil {
utils.Log("ERROR:", err)
utils.Log("ERROR: marshaling yaml", err)
return
}
outb = append([]byte("---\n\n"), outb...) // preserve the separator to make yaml lint happy
if err := os.WriteFile(requirementsPath, outb, 0o600); err != nil {
utils.Log("ERROR:", err)
utils.Log("ERROR: writing file", requirementsPath, err)
}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/parser/roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func getNewVersion(src, version string) string {
repo := strings.Replace(src, "git+https", "https", 1)
tags, err := utils.Run("git ls-remote -tq --sort=-version:refname "+repo, "")
if err != nil {
utils.Log("ERROR:", err)
utils.Log("ERROR: git ls-remote", repo, err)
return ""
}
if tags == "" {
Expand Down

0 comments on commit 2d00c23

Please sign in to comment.