build: improve error message in the stack direcive.
This commit is contained in:
parent
e83a9a60dc
commit
d9430c68c1
1 changed files with 4 additions and 1 deletions
|
|
@ -55,7 +55,10 @@ func (s Stack) Apply(opt *Option, profile string) (string, error) {
|
||||||
|
|
||||||
res := ""
|
res := ""
|
||||||
for name := range opt.ArgMap {
|
for name := range opt.ArgMap {
|
||||||
stackedProfile := prebuild.RootApparmord.Join(name).MustReadFileAsString()
|
stackedProfile, err := prebuild.RootApparmord.Join(name).ReadFileAsString()
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("%s need to stack: %w", name, err)
|
||||||
|
}
|
||||||
m := regRules.FindStringSubmatch(stackedProfile)
|
m := regRules.FindStringSubmatch(stackedProfile)
|
||||||
if len(m) < 2 {
|
if len(m) < 2 {
|
||||||
return "", fmt.Errorf("no profile found in %s", name)
|
return "", fmt.Errorf("no profile found in %s", name)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue