THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

This is Gitea test Portainer repository mirror from Github
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

118 lines
3.3 KiB

  1. package portainer
  2. // General errors.
  3. const (
  4. ErrUnauthorized = Error("Unauthorized")
  5. ErrResourceAccessDenied = Error("Access denied to resource")
  6. ErrAuthorizationRequired = Error("Authorization required for this operation")
  7. ErrObjectNotFound = Error("Object not found inside the database")
  8. ErrMissingSecurityContext = Error("Unable to find security details in request context")
  9. )
  10. // User errors.
  11. const (
  12. ErrUserAlreadyExists = Error("User already exists")
  13. ErrInvalidUsername = Error("Invalid username. White spaces are not allowed")
  14. ErrAdminAlreadyInitialized = Error("An administrator user already exists")
  15. ErrAdminCannotRemoveSelf = Error("Cannot remove your own user account. Contact another administrator")
  16. ErrCannotRemoveLastLocalAdmin = Error("Cannot remove the last local administrator account")
  17. )
  18. // Team errors.
  19. const (
  20. ErrTeamAlreadyExists = Error("Team already exists")
  21. )
  22. // TeamMembership errors.
  23. const (
  24. ErrTeamMembershipAlreadyExists = Error("Team membership already exists for this user and team")
  25. )
  26. // ResourceControl errors.
  27. const (
  28. ErrResourceControlAlreadyExists = Error("A resource control is already applied on this resource")
  29. ErrInvalidResourceControlType = Error("Unsupported resource control type")
  30. )
  31. // Endpoint errors.
  32. const (
  33. ErrEndpointAccessDenied = Error("Access denied to endpoint")
  34. )
  35. // Azure environment errors
  36. const (
  37. ErrAzureInvalidCredentials = Error("Invalid Azure credentials")
  38. )
  39. // Endpoint group errors.
  40. const (
  41. ErrCannotRemoveDefaultGroup = Error("Cannot remove the default endpoint group")
  42. )
  43. // Registry errors.
  44. const (
  45. ErrRegistryAlreadyExists = Error("A registry is already defined for this URL")
  46. )
  47. // Stack errors
  48. const (
  49. ErrStackAlreadyExists = Error("A stack already exists with this name")
  50. ErrComposeFileNotFoundInRepository = Error("Unable to find a Compose file in the repository")
  51. ErrStackNotExternal = Error("Not an external stack")
  52. )
  53. // Tag errors
  54. const (
  55. ErrTagAlreadyExists = Error("A tag already exists with this name")
  56. )
  57. // Endpoint extensions error
  58. const (
  59. ErrEndpointExtensionNotSupported = Error("This extension is not supported")
  60. ErrEndpointExtensionAlreadyAssociated = Error("This extension is already associated to the endpoint")
  61. )
  62. // Crypto errors.
  63. const (
  64. ErrCryptoHashFailure = Error("Unable to hash data")
  65. )
  66. // JWT errors.
  67. const (
  68. ErrSecretGeneration = Error("Unable to generate secret key")
  69. ErrInvalidJWTToken = Error("Invalid JWT token")
  70. ErrMissingContextData = Error("Unable to find JWT data in request context")
  71. )
  72. // File errors.
  73. const (
  74. ErrUndefinedTLSFileType = Error("Undefined TLS file type")
  75. )
  76. // Extension errors.
  77. const (
  78. ErrExtensionAlreadyEnabled = Error("This extension is already enabled")
  79. )
  80. // Docker errors.
  81. const (
  82. ErrUnableToPingEndpoint = Error("Unable to communicate with the endpoint")
  83. )
  84. // Schedule errors.
  85. const (
  86. ErrHostManagementFeaturesDisabled = Error("Host management features are disabled")
  87. )
  88. // Error represents an application error.
  89. type Error string
  90. // Error returns the error message.
  91. func (e Error) Error() string { return string(e) }
  92. // Webhook errors
  93. const (
  94. ErrWebhookAlreadyExists = Error("A webhook for this resource already exists")
  95. ErrUnsupportedWebhookType = Error("Webhooks for this resource are not currently supported")
  96. )