plugin/rewrite: tweak parse error messaging, add tests (#1737)

* tweak parse error messaging, add tests

* looser err msg checking
This commit is contained in:
Chris O'Haver
2018-04-25 15:48:32 -04:00
committed by Miek Gieben
parent 9e8893a0b5
commit 5e06687ee5
4 changed files with 63 additions and 3 deletions

View File

@@ -167,7 +167,7 @@ func newNameRule(nextAction string, args ...string) (Rule, error) {
return nil, fmt.Errorf("the rewrite of response is supported only for name regex rule")
}
if len(args) > 3 && len(args) != 7 {
return nil, fmt.Errorf("exceeded the number of arguments for a name rule")
return nil, fmt.Errorf("response rewrites must consist only of a name rule with 3 arguments and an answer rule with 3 arguments")
}
return &nameRule{nextAction, plugin.Name(args[0]).Normalize(), plugin.Name(args[1]).Normalize()}, nil
}