Return on toml parse errors instead of logging (#7751)

This commit is contained in:
Daniel Nelson 2020-06-26 11:30:29 -07:00 committed by GitHub
parent f063ff78f2
commit cfc1818a5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -1119,7 +1119,7 @@ func buildAggregator(name string, tbl *ast.Table) (*models.AggregatorConfig, err
var err error
conf.DropOriginal, err = strconv.ParseBool(b.Value)
if err != nil {
log.Printf("Error parsing boolean value for %s: %s\n", name, err)
return nil, fmt.Errorf("error parsing boolean value for %s: %s", name, err)
}
}
}
@ -1161,7 +1161,7 @@ func buildAggregator(name string, tbl *ast.Table) (*models.AggregatorConfig, err
if node, ok := tbl.Fields["tags"]; ok {
if subtbl, ok := node.(*ast.Table); ok {
if err := toml.UnmarshalTable(subtbl, conf.Tags); err != nil {
log.Printf("Could not parse tags for input %s\n", name)
return nil, fmt.Errorf("could not parse tags for input %s", name)
}
}
}
@ -1195,7 +1195,7 @@ func buildProcessor(name string, tbl *ast.Table) (*models.ProcessorConfig, error
var err error
conf.Order, err = strconv.ParseInt(b.Value, 10, 64)
if err != nil {
log.Printf("Error parsing int value for %s: %s\n", name, err)
return nil, fmt.Errorf("error parsing int value for %s: %s", name, err)
}
}
}
@ -1410,7 +1410,7 @@ func buildInput(name string, tbl *ast.Table) (*models.InputConfig, error) {
if node, ok := tbl.Fields["tags"]; ok {
if subtbl, ok := node.(*ast.Table); ok {
if err := toml.UnmarshalTable(subtbl, cp.Tags); err != nil {
log.Printf("E! Could not parse tags for input %s\n", name)
return nil, fmt.Errorf("could not parse tags for input %s\n", name)
}
}
}