Skip to content

Commit

Permalink
Merge pull request #27 from requiemofthesouls/hotfix/validate-custom-…
Browse files Browse the repository at this point in the history
…error

[FIX] Return custom error on email validation
  • Loading branch information
requiemofthesouls authored Jan 31, 2022
2 parents 25b9b16 + 0b7499d commit 4e7937e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/domain/pigeomail/model.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package pigeomail

import (
"errors"
"net/mail"

customerrors "pigeomail/internal/errors"
)

type EMail struct {
Expand All @@ -13,7 +14,7 @@ type EMail struct {

func (e *EMail) Validate() (err error) {
if _, err = mail.ParseAddress(e.Name); err != nil {
return errors.New("mail name isn't valid, please choose a new one")
return customerrors.NewTelegramError("mail name isn't valid, please choose a new one")
}

return nil
Expand Down

0 comments on commit 4e7937e

Please # to comment.