Display error message on badly formatted config string array (eg. namepass) (#8910)

* add error when expected string array is not in string array format

* add word
This commit is contained in:
David Bennett 2021-02-26 13:58:13 -05:00 committed by GitHub
parent 7ed98c7e5c
commit 956350db94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -1538,6 +1538,9 @@ func (c *Config) getFieldStringSlice(tbl *ast.Table, fieldName string, target *[
*target = append(*target, str.Value)
}
}
} else {
c.addError(tbl, fmt.Errorf("found unexpected format while parsing %q, expecting string array/slice format", fieldName))
return
}
}
}
@ -1554,6 +1557,9 @@ func (c *Config) getFieldTagFilter(tbl *ast.Table, fieldName string, target *[]m
tagfilter.Filter = append(tagfilter.Filter, str.Value)
}
}
} else {
c.addError(tbl, fmt.Errorf("found unexpected format while parsing %q, expecting string array/slice format on each entry", fieldName))
return
}
*target = append(*target, tagfilter)
}