Skip to content

Commit

Permalink
Made the error clearer when an address is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcesaro committed Apr 11, 2016
1 parent 4291610 commit 92eaa13
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions send.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,9 @@ func addAddress(list []string, addr string) []string {
}

func parseAddress(field string) (string, error) {
a, err := mail.ParseAddress(field)
if a == nil {
return "", err
addr, err := mail.ParseAddress(field)
if err != nil {
return "", fmt.Errorf("gomail: invalid address %q: %v", field, err)
}

return a.Address, err
return addr.Address, nil
}

0 comments on commit 92eaa13

Please sign in to comment.