Skip to content

Commit

Permalink
Error messages not being reported unless more then one error present
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Jan 4, 2024
1 parent a1da24d commit f0319d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/quadlet/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ func loadUnitsFromDir(sourcePath string) ([]*parser.UnitFile, error) {

if f, err := parser.ParseUnitFile(path); err != nil {
err = fmt.Errorf("error loading %q, %w", path, err)
if prevError != nil {
if prevError == nil {
prevError = err
} else {
prevError = fmt.Errorf("%s\n%s", prevError, err)
}
} else {
Expand Down
1 change: 1 addition & 0 deletions test/e2e/quadlet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ BOGUS=foo
session := podmanTest.Quadlet([]string{"-dryrun"}, podmanTest.TempDir)
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(1))
Expect(session.ErrorToString()).To(ContainSubstring("converting \"bogus.container\": unsupported key 'BOGUS' in group 'Container' in " + quadletfilePath))
})

It("Should scan and return output for files in subdirectories", func() {
Expand Down

0 comments on commit f0319d5

Please sign in to comment.