2016-12-18 05:21:29 +00:00
|
|
|
package portainer
|
|
|
|
|
|
|
|
// General errors.
|
|
|
|
const (
|
2017-05-23 18:56:10 +00:00
|
|
|
ErrUnauthorized = Error("Unauthorized")
|
|
|
|
ErrResourceAccessDenied = Error("Access denied to resource")
|
|
|
|
ErrUnsupportedDockerAPI = Error("Unsupported Docker API response")
|
|
|
|
ErrMissingSecurityContext = Error("Unable to find security details in request context")
|
2016-12-18 05:21:29 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// User errors.
|
|
|
|
const (
|
2017-01-12 05:17:28 +00:00
|
|
|
ErrUserNotFound = Error("User not found")
|
2017-03-12 16:24:15 +00:00
|
|
|
ErrUserAlreadyExists = Error("User already exists")
|
2017-05-23 18:56:10 +00:00
|
|
|
ErrInvalidUsername = Error("Invalid username. White spaces are not allowed.")
|
2017-01-12 05:17:28 +00:00
|
|
|
ErrAdminAlreadyInitialized = Error("Admin user already initialized")
|
2016-12-18 05:21:29 +00:00
|
|
|
)
|
|
|
|
|
2017-05-23 18:56:10 +00:00
|
|
|
// Team errors.
|
|
|
|
const (
|
|
|
|
ErrTeamNotFound = Error("Team not found")
|
|
|
|
ErrTeamAlreadyExists = Error("Team already exists")
|
|
|
|
)
|
|
|
|
|
|
|
|
// TeamMembership errors.
|
|
|
|
const (
|
|
|
|
ErrTeamMembershipNotFound = Error("Team membership not found")
|
|
|
|
ErrTeamMembershipAlreadyExists = Error("Team membership already exists for this user and team.")
|
|
|
|
)
|
|
|
|
|
|
|
|
// ResourceControl errors.
|
|
|
|
const (
|
|
|
|
ErrResourceControlNotFound = Error("Resource control not found")
|
|
|
|
ErrResourceControlAlreadyExists = Error("A resource control is already applied on this resource")
|
|
|
|
ErrInvalidResourceControlType = Error("Unsupported resource control type")
|
|
|
|
)
|
|
|
|
|
2016-12-25 20:34:02 +00:00
|
|
|
// Endpoint errors.
|
|
|
|
const (
|
2017-03-12 16:24:15 +00:00
|
|
|
ErrEndpointNotFound = Error("Endpoint not found")
|
|
|
|
ErrEndpointAccessDenied = Error("Access denied to endpoint")
|
|
|
|
)
|
|
|
|
|
|
|
|
// Version errors.
|
|
|
|
const (
|
|
|
|
ErrDBVersionNotFound = Error("DB version not found")
|
2016-12-25 20:34:02 +00:00
|
|
|
)
|
|
|
|
|
2016-12-18 05:21:29 +00:00
|
|
|
// Crypto errors.
|
|
|
|
const (
|
|
|
|
ErrCryptoHashFailure = Error("Unable to hash data")
|
|
|
|
)
|
|
|
|
|
|
|
|
// JWT errors.
|
|
|
|
const (
|
2017-03-12 16:24:15 +00:00
|
|
|
ErrSecretGeneration = Error("Unable to generate secret key")
|
|
|
|
ErrInvalidJWTToken = Error("Invalid JWT token")
|
|
|
|
ErrMissingContextData = Error("Unable to find JWT data in request context")
|
2016-12-18 05:21:29 +00:00
|
|
|
)
|
|
|
|
|
2016-12-25 20:34:02 +00:00
|
|
|
// File errors.
|
|
|
|
const (
|
|
|
|
ErrUndefinedTLSFileType = Error("Undefined TLS file type")
|
|
|
|
)
|
|
|
|
|
2016-12-18 05:21:29 +00:00
|
|
|
// Error represents an application error.
|
|
|
|
type Error string
|
|
|
|
|
|
|
|
// Error returns the error message.
|
|
|
|
func (e Error) Error() string { return string(e) }
|