Skip to content

Commit

Permalink
Merge pull request #105 from look/prefix-validation-err
Browse files Browse the repository at this point in the history
Prefix validation error with argument name
  • Loading branch information
akamensky committed Jul 31, 2022
2 parents 65ad70c + f8e9eea commit 31775b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions argument.go
Expand Up @@ -406,11 +406,11 @@ func (o *arg) parse(args []string, argCount int) error {
return fmt.Errorf("[%s] can only be present once", o.name())
}

// If validation function provided -- execute, on error return it immediately
// If validation function provided -- execute, on error return immediately
if o.opts != nil && o.opts.Validate != nil {
err := o.opts.Validate(args)
if err != nil {
return err
return fmt.Errorf("[%s] %w", o.name(), err)
}
}
return o.parseSomeType(args, argCount)
Expand Down

0 comments on commit 31775b7

Please sign in to comment.