您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. from libs.exception import BaseHTTPException
  2. class AlreadySetupError(BaseHTTPException):
  3. error_code = "already_setup"
  4. description = "Dify has been successfully installed. Please refresh the page or return to the dashboard homepage."
  5. code = 403
  6. class NotSetupError(BaseHTTPException):
  7. error_code = "not_setup"
  8. description = (
  9. "Dify has not been initialized and installed yet. "
  10. "Please proceed with the initialization and installation process first."
  11. )
  12. code = 401
  13. class NotInitValidateError(BaseHTTPException):
  14. error_code = "not_init_validated"
  15. description = "Init validation has not been completed yet. Please proceed with the init validation process first."
  16. code = 401
  17. class InitValidateFailedError(BaseHTTPException):
  18. error_code = "init_validate_failed"
  19. description = "Init validation failed. Please check the password and try again."
  20. code = 401
  21. class AccountNotLinkTenantError(BaseHTTPException):
  22. error_code = "account_not_link_tenant"
  23. description = "Account not link tenant."
  24. code = 403
  25. class AlreadyActivateError(BaseHTTPException):
  26. error_code = "already_activate"
  27. description = "Auth Token is invalid or account already activated, please check again."
  28. code = 403
  29. class NotAllowedCreateWorkspace(BaseHTTPException):
  30. error_code = "not_allowed_create_workspace"
  31. description = "Workspace not found, please contact system admin to invite you to join in a workspace."
  32. code = 400
  33. class WorkspaceMembersLimitExceeded(BaseHTTPException):
  34. error_code = "limit_exceeded"
  35. description = "Unable to add member because the maximum workspace's member limit was exceeded"
  36. code = 400
  37. class WorkspacesLimitExceeded(BaseHTTPException):
  38. error_code = "limit_exceeded"
  39. description = "Unable to create workspace because the maximum workspace limit was exceeded"
  40. code = 400
  41. class AccountBannedError(BaseHTTPException):
  42. error_code = "account_banned"
  43. description = "Account is banned."
  44. code = 400
  45. class AccountNotFound(BaseHTTPException):
  46. error_code = "account_not_found"
  47. description = "Account not found."
  48. code = 400
  49. class EmailSendIpLimitError(BaseHTTPException):
  50. error_code = "email_send_ip_limit"
  51. description = "Too many emails have been sent from this IP address recently. Please try again later."
  52. code = 429
  53. class FileTooLargeError(BaseHTTPException):
  54. error_code = "file_too_large"
  55. description = "File size exceeded. {message}"
  56. code = 413
  57. class UnsupportedFileTypeError(BaseHTTPException):
  58. error_code = "unsupported_file_type"
  59. description = "File type not allowed."
  60. code = 415
  61. class TooManyFilesError(BaseHTTPException):
  62. error_code = "too_many_files"
  63. description = "Only one file is allowed."
  64. code = 400
  65. class NoFileUploadedError(BaseHTTPException):
  66. error_code = "no_file_uploaded"
  67. description = "Please upload your file."
  68. code = 400
  69. class UnauthorizedAndForceLogout(BaseHTTPException):
  70. error_code = "unauthorized_and_force_logout"
  71. description = "Unauthorized and force logout."
  72. code = 401
  73. class AccountInFreezeError(BaseHTTPException):
  74. error_code = "account_in_freeze"
  75. code = 400
  76. description = (
  77. "This email account has been deleted within the past 30 days"
  78. "and is temporarily unavailable for new account registration."
  79. )
  80. class EducationVerifyLimitError(BaseHTTPException):
  81. error_code = "education_verify_limit"
  82. description = "Rate limit exceeded"
  83. code = 429
  84. class EducationActivateLimitError(BaseHTTPException):
  85. error_code = "education_activate_limit"
  86. description = "Rate limit exceeded"
  87. code = 429
  88. class CompilanceRateLimitError(BaseHTTPException):
  89. error_code = "compilance_rate_limit"
  90. description = "Rate limit exceeded for downloading compliance report."
  91. code = 429