fix: using a clearer error message when a module parameter is not valid

This commit is contained in:
evilsocket 2018-02-08 08:30:27 +01:00
parent 3a29ca1fbb
commit 5bd57ee255

View file

@ -59,7 +59,7 @@ func NewIntParameter(name string, def_value string, desc string) *ModuleParam {
func (p ModuleParam) Validate(value string) (error, interface{}) { func (p ModuleParam) Validate(value string) (error, interface{}) {
if p.Validator != nil { if p.Validator != nil {
if p.Validator.MatchString(value) == false { if p.Validator.MatchString(value) == false {
return fmt.Errorf("%s: value '%s' does not validate '%s'.", core.Bold(p.Name), value, p.Validator.String()), nil return fmt.Errorf("Parameter %s not valid: '%s' does not match rule '%s'.", core.Bold(p.Name), value, p.Validator.String()), nil
} }
} }