Skip to content

Commit 8aca314

Browse files
committed
Update error message for apparmor parser
Signed-off-by: Derek McGowan <[email protected]>
1 parent 77d53d2 commit 8aca314

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

contrib/apparmor/template.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func generate(p *data, o io.Writer) error {
151151
func load(path string) error {
152152
out, err := aaParser("-Kr", path)
153153
if err != nil {
154-
return fmt.Errorf("%s: %s", err, out)
154+
return fmt.Errorf("parser error(%q): %w", strings.TrimSpace(out), err)
155155
}
156156
return nil
157157
}
@@ -164,10 +164,7 @@ func macroExists(m string) bool {
164164

165165
func aaParser(args ...string) (string, error) {
166166
out, err := exec.Command("apparmor_parser", args...).CombinedOutput()
167-
if err != nil {
168-
return "", err
169-
}
170-
return string(out), nil
167+
return string(out), err
171168
}
172169

173170
func getVersion() (int, error) {

0 commit comments

Comments
 (0)