errors.rs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. use serde_repr::*;
  2. use thiserror::Error;
  3. #[derive(Debug, Clone, PartialEq, Eq, Error, Serialize_repr, Deserialize_repr)]
  4. #[repr(u8)]
  5. pub enum UserErrorCode {
  6. #[error("Internal error")]
  7. Internal = 0,
  8. #[error("Workspace id can not be empty or whitespace")]
  9. WorkspaceIdInvalid = 1,
  10. #[error("Email can not be empty or whitespace")]
  11. EmailIsEmpty = 2,
  12. #[error("Email format is not valid")]
  13. EmailFormatInvalid = 3,
  14. #[error("user id is empty or whitespace")]
  15. UserIdInvalid = 4,
  16. #[error("User name contain forbidden characters")]
  17. UserNameContainForbiddenCharacters = 5,
  18. #[error("User name can not be empty or whitespace")]
  19. UserNameIsEmpty = 6,
  20. #[error("User not exist")]
  21. UserNotExist = 7,
  22. #[error("Password can not be empty or whitespace")]
  23. PasswordIsEmpty = 8,
  24. #[error("Password format too long")]
  25. PasswordTooLong = 9,
  26. #[error("Password contains forbidden characters.")]
  27. PasswordContainsForbidCharacters = 10,
  28. #[error(
  29. "Password should contain a minimum of 6 characters with 1 special 1 letter and 1 numeric"
  30. )]
  31. PasswordFormatInvalid = 11,
  32. #[error("Password not match")]
  33. PasswordNotMatch = 12,
  34. #[error("User name is too long")]
  35. UserNameTooLong = 13,
  36. }