user_mail.go 760 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright 2015 The Gogs Authors. All rights reserved.
  2. // Copyright 2018 Gitote. All rights reserved.
  3. //
  4. // This source code is licensed under the MIT license found in the
  5. // LICENSE file in the root directory of this source tree.
  6. package errors
  7. import "fmt"
  8. type EmailNotFound struct {
  9. Email string
  10. }
  11. func IsEmailNotFound(err error) bool {
  12. _, ok := err.(EmailNotFound)
  13. return ok
  14. }
  15. func (err EmailNotFound) Error() string {
  16. return fmt.Sprintf("email is not found [email: %s]", err.Email)
  17. }
  18. type EmailNotVerified struct {
  19. Email string
  20. }
  21. func IsEmailNotVerified(err error) bool {
  22. _, ok := err.(EmailNotVerified)
  23. return ok
  24. }
  25. func (err EmailNotVerified) Error() string {
  26. return fmt.Sprintf("email has not been verified [email: %s]", err.Email)
  27. }