e

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMessage

func GetMessage(code ErrorCode) string

func HasErrorCode

func HasErrorCode(err error, codes ...ErrorCode) bool

HasErrorCode verify the type of error and the code.

func IsError

func IsError(err error) bool

Types

type Error

type Error struct {
	Code    ErrorCode
	Message string
	Wrap    error
	// contains filtered or unexported fields
}

func NewError

func NewError(code ErrorCode, wrap error) *Error

func NewErrorWithMessage

func NewErrorWithMessage(code ErrorCode, message string, wrap error) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) GetHTTPCode

func (e *Error) GetHTTPCode() int

GetHTTPCode returns the HTTP code.

func (*Error) SetHTTPCode

func (e *Error) SetHTTPCode(code int)

SetHTTPCode sets the HTTP code manually.

func (*Error) Unwrap

func (e *Error) Unwrap() error

type ErrorCode

type ErrorCode string
const (
	// ErrorCodeConfigInvalid is that an error occurs when it parse the file.
	ErrorCodeConfigInvalid ErrorCode = "config_parse_error"
	// ErrorCodeConfigUndefinedEnv is that the environment is not defined in the configuration file.
	ErrorCodeConfigUndefinedEnv ErrorCode = "config_undefined_env"

	// ErrorCodeDeploymentConflict is the deployment number is conflicted.
	ErrorCodeDeploymentConflict ErrorCode = "deployment_conflict"
	// ErrorCodeDeploymentInvalid is the payload is invalid.
	ErrorCodeDeploymentInvalid ErrorCode = "deployment_invalid"
	// ErrorCodeDeploymentLocked is when the environment is locked.
	ErrorCodeDeploymentLocked ErrorCode = "deployment_locked"
	// ErrorCodeDeploymentFrozen is when the time in in the freeze window.
	ErrorCodeDeploymentFrozen ErrorCode = "deployment_frozen"
	// ErrorCodeDeploymentUnapproved is when the deployment is not approved.
	ErrorCodeDeploymentNotApproved ErrorCode = "deployment_not_approved"
	// ErrorCodeDeploymentSerialization is the serialization error.
	ErrorCodeDeploymentSerialization ErrorCode = "deployment_serialization"
	// ErrorCodeDeploymentStatusNotWaiting is the status must be 'waiting' to create a remote deployment.
	ErrorCodeDeploymentStatusInvalid ErrorCode = "deployment_status_invalid"

	// ErrorCodeEntityNotFound is the entity is not found.
	// Entity is a resource of store or scm.
	ErrorCodeEntityNotFound ErrorCode = "entity_not_found"
	// ErrorCodeEntityUnprocessable is the entity is unprocessable.
	ErrorCodeEntityUnprocessable ErrorCode = "entity_unprocessable"

	// ErrorCodeInternalError is the internal error couldn't be handled.
	ErrorCodeInternalError ErrorCode = "internal_error"

	// ErrorCodeLockAlreadyExist is that the environment is already locked.
	ErrorCodeLockAlreadyExist ErrorCode = "lock_already_exist"

	// ErrorCodeLicenseDecode is the error when the license is decoded.
	ErrorCodeLicenseDecode ErrorCode = "license_decode"
	// ErrorCodeLicenseRequired is that the license is required.
	ErrorCodeLicenseRequired ErrorCode = "license_required"

	// ErrorCodeParameterInvalid is a parameter of a request is invalid.
	ErrorCodeParameterInvalid ErrorCode = "parameter_invalid"

	// ErrorPermissionRequired is the permission is required to access.
	ErrorPermissionRequired ErrorCode = "permission_required"

	// ErrorRepoUniqueName is the repository name must be unique.
	ErrorRepoUniqueName ErrorCode = "repo_unique_name"
)

type ErrorStatus

type ErrorStatus int

Jump to

Keyboard shortcuts

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