user_mail.go 526 B

123456789101112131415161718192021222324252627282930
  1. package errors
  2. import "fmt"
  3. type EmailNotFound struct {
  4. Email string
  5. }
  6. func IsEmailNotFound(err error) bool {
  7. _, ok := err.(EmailNotFound)
  8. return ok
  9. }
  10. func (err EmailNotFound) Error() string {
  11. return fmt.Sprintf("email is not found [email: %s]", err.Email)
  12. }
  13. type EmailNotVerified struct {
  14. Email string
  15. }
  16. func IsEmailNotVerified(err error) bool {
  17. _, ok := err.(EmailNotVerified)
  18. return ok
  19. }
  20. func (err EmailNotVerified) Error() string {
  21. return fmt.Sprintf("email has not been verified [email: %s]", err.Email)
  22. }