errcode

package
v1.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MissingParamUserName             = New(missingParam, "name")
	MissingParamPassword             = New(missingParam, "password")
	InvalidParameterPassword         = New(invalidParamValue, "password")
	InvalidParameterPhone            = New(invalidParamValue, "phone")
	InvalidParameterEmail            = New(invalidParamValue, "email")
	MissingParamFile                 = New(missingParam, "file")
	MissingParamNameOrPwdOrLoginType = New(missingParam, "name or password or login type")

	AuthenticateError = New(authenticateError)
	UserNotExist      = New(userNotExist)
	InvalidToken      = New(invalidToken)
	ForbiddenErr      = New(forbidden)
	LdapConnectError  = New(ldapConnectError)
	PasswordWrong     = New(passwordWrong)
	UserIsDisabled    = New(userIsDisabled)
)
View Source
var (
	InvalidBodyFormat      = New(invalidBodyFormat)
	InvalidFileType        = New(invalidFileType)
	InvalidResourceTypeErr = New(invalidResourceType)
	InvalidHttpMethod      = New(invalidHttpMethod)
)
View Source
var (
	UserNotExistErr   = New(&ErrorInfo{Code: http.StatusBadRequest, Message: "user not exist."})
	KeyNotExistErr    = New(&ErrorInfo{Code: http.StatusBadRequest, Message: "key not exist."})
	NotMatchErr       = New(&ErrorInfo{Code: http.StatusBadRequest, Message: "key and user not match."})
	SecretNotMatchErr = New(&ErrorInfo{Code: http.StatusBadRequest, Message: "secretkey and accesskey not match."})
	MaxKeyErr         = New(&ErrorInfo{Code: http.StatusBadRequest, Message: "already have 5 credentials, can't create more."})
	ServerErr         = New(&ErrorInfo{Code: http.StatusInternalServerError, Message: "server error."})
	NotFoundErr       = New(&ErrorInfo{Code: http.StatusNotFound, Message: "not found"})
)
View Source
var (
	MissNamespaceInObj = New(&ErrorInfo{http.StatusBadRequest, "miss namespace in .metadata.namespace."})
	MissNameInObj      = New(&ErrorInfo{http.StatusBadRequest, "miss namespace in .metadata.name."})
)

Functions

This section is empty.

Types

type ErrorInfo

type ErrorInfo struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func AlreadyExist added in v1.8.3

func AlreadyExist(resource interface{}) *ErrorInfo

func BadRequest

func BadRequest(err error) *ErrorInfo

func ClusterNotFoundError

func ClusterNotFoundError(clusterName string) *ErrorInfo

func CreateMappingError

func CreateMappingError(err string) *ErrorInfo

func CreateResourceError

func CreateResourceError(resourceType string) *ErrorInfo

func CustomReturn

func CustomReturn(code int, format string, params ...interface{}) *ErrorInfo

func DealError

func DealError(err error) *ErrorInfo

func DeployYamlError

func DeployYamlError(err string) *ErrorInfo

func GetResourceError

func GetResourceError(resourceType string) *ErrorInfo

func New

func New(errorInfo *ErrorInfo, params ...interface{}) *ErrorInfo

func ParamsInvalid added in v1.8.3

func ParamsInvalid(err error) *ErrorInfo

func ParamsMissing added in v1.8.8

func ParamsMissing(param string) *ErrorInfo

func UpdateResourceError

func UpdateResourceError(resourceType string) *ErrorInfo

func UserNameDuplicated

func UserNameDuplicated(name string) *ErrorInfo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL