user_mail.go 688 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2017 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package errors
  5. import "fmt"
  6. type EmailNotFound struct {
  7. Email string
  8. }
  9. func IsEmailNotFound(err error) bool {
  10. _, ok := err.(EmailNotFound)
  11. return ok
  12. }
  13. func (err EmailNotFound) Error() string {
  14. return fmt.Sprintf("email is not found [email: %s]", err.Email)
  15. }
  16. type EmailNotVerified struct {
  17. Email string
  18. }
  19. func IsEmailNotVerified(err error) bool {
  20. _, ok := err.(EmailNotVerified)
  21. return ok
  22. }
  23. func (err EmailNotVerified) Error() string {
  24. return fmt.Sprintf("email has not been verified [email: %s]", err.Email)
  25. }