httperrors

package
v0.0.0-...-6410feb Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrBadGateway       = errors.Error("BadGateway")
	ErrNotImplemented   = errors.ErrNotImplemented
	ErrInternalError    = errors.Error("InternalServerError")
	ErrResourceNotReady = errors.Error("ResourceNotReadyError")
	ErrPayment          = errors.Error("PaymentError")

	ErrImageNotFound    = errors.Error("ImageNotFoundError")
	ErrResourceNotFound = errors.Error("ResourceNotFoundError")
	ErrSpecNotFound     = errors.Error("SpecNotFoundError")
	ErrActionNotFound   = errors.Error("ActionNotFoundError")
	ErrTenantNotFound   = errors.Error("TenantNotFoundError")

	ErrServerStatus     = errors.Error("ServerStatusError")
	ErrInvalidStatus    = errors.ErrInvalidStatus
	ErrInvalidIdpStatus = errors.Error("InvalidIdpStatus")
	ErrInvalidFormat    = errors.ErrInvalidFormat

	ErrInputParameter   = errors.Error("InputParameterError")
	ErrWeakPassword     = errors.Error("WeakPasswordError")
	ErrMissingParameter = errors.Error("MissingParameterError")

	ErrInsufficientResource = errors.Error("InsufficientResourceError")
	ErrOutOfResource        = errors.Error("OutOfResource")
	ErrOutOfQuota           = errors.Error("OutOfQuotaError")
	ErrOutOfRange           = errors.Error("OutOfRange")
	ErrOutOfLimit           = errors.Error("OutOfLimit")

	ErrNotSufficientPrivilege = errors.Error("NotSufficientPrivilegeError")

	ErrUnsupportedOperation = errors.Error("UnsupportOperationError")
	ErrNotSupported         = errors.ErrNotSupported

	ErrNotEmpty     = errors.Error("NotEmptyError")
	ErrBadRequest   = errors.Error("BadRequestError")
	ErrEmptyRequest = errors.Error("EmptyRequestError")

	ErrUnauthorized      = errors.Error("UnauthorizedError")
	ErrInvalidCredential = errors.Error("InvalidCredentialError")
	ErrUnauthenticated   = ErrInvalidCredential
	ErrForbidden         = errors.Error("ForbiddenError")

	ErrNotFound = errors.ErrNotFound

	ErrNotAcceptable = errors.Error("NotAcceptableError")

	ErrDuplicateName     = errors.Error("DuplicateNameError")
	ErrDuplicateResource = errors.Error("DuplicateResourceError")
	ErrConflict          = errors.Error("ConflictError")
	ErrDuplicateId       = errors.ErrDuplicateId

	ErrResourceBusy   = errors.Error("ResourceBusyError")
	ErrRequireLicense = errors.Error("RequireLicenseError")

	ErrTimeout           = errors.ErrTimeout
	ErrProtectedResource = errors.Error("ProtectedResourceError")
	ErrNoProject         = errors.Error("NoProjectError")

	ErrInvalidProvider     = errors.Error("InvalidProvider")
	ErrNoBalancePermission = errors.Error("NoBalancePermission")

	ErrTooLarge = errors.Error("TooLargeEntity")

	ErrTooManyAttempts = errors.Error("TooManyFailedAttempts")
	ErrTooManyRequests = errors.Error("TooManyRequests")

	ErrUnsupportedProtocol = errors.ErrUnsupportedProtocol

	ErrPolicyDefinition = errors.Error("PolicyDefinitionError")

	ErrUserNotFound                = errors.Error("UserNotFound")
	ErrUserLocked                  = errors.Error("UserLocked")
	ErrUserDisabled                = errors.Error("UserDisabled")
	ErrWrongPassword               = errors.Error("WrongPassword")
	ErrIncorrectUsernameOrPassword = errors.Error("IncorrectUsernameOrPassword")

	ErrServiceAbnormal = errors.Error("ServiceAbnormal")

	ErrInvalidAccessKey = errors.Error("InvalidAccessKey")
	ErrNoPermission     = errors.Error("NoPermission")
)

Variables

This section is empty.

Functions

func BadGatewayError

func BadGatewayError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

func BadRequestError

func BadRequestError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

func ConflictError

func ConflictError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

func ForbiddenError

func ForbiddenError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

func FsErrorNormalize

func FsErrorNormalize(err error) error

ErrInvalid = fs.ErrInvalid // "invalid argument"

ErrPermission = fs.ErrPermission // "permission denied" ErrExist = fs.ErrExist // "file already exists" ErrNotExist = fs.ErrNotExist // "file does not exist" ErrClosed = fs.ErrClosed // "file already closed"

ErrNoDeadline = errNoDeadline() // "file type does not support deadline" ErrDeadlineExceeded = errDeadlineExceeded() // "i/o timeout"

func GeneralServerError

func GeneralServerError(ctx context.Context, w http.ResponseWriter, e error)

func GetTimeZone

func GetTimeZone() *time.Location

func HTTPError

func HTTPError(ctx context.Context, w http.ResponseWriter, msg string, statusCode int, class string, errData httputils.Error)

func InputParameterError

func InputParameterError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

func InternalServerError

func InternalServerError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

func InvalidCredentialError

func InvalidCredentialError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

func InvalidInputError

func InvalidInputError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

func MissingParameterError

func MissingParameterError(ctx context.Context, w http.ResponseWriter, param string)

func NewActionNotFoundError

func NewActionNotFoundError(msg string, params ...interface{}) *httputils.JSONClientError

func NewBadGatewayError

func NewBadGatewayError(msg string, params ...interface{}) *httputils.JSONClientError

func NewBadRequestError

func NewBadRequestError(msg string, params ...interface{}) *httputils.JSONClientError

func NewClientError

func NewClientError(msg string, params ...interface{}) *httputils.JSONClientError

func NewConflictError

func NewConflictError(msg string, params ...interface{}) *httputils.JSONClientError

func NewDuplicateIdError

func NewDuplicateIdError(resName string, resId string) *httputils.JSONClientError

func NewDuplicateNameError

func NewDuplicateNameError(resName string, resId string) *httputils.JSONClientError

func NewDuplicateResourceError

func NewDuplicateResourceError(msg string, params ...interface{}) *httputils.JSONClientError

func NewForbiddenError

func NewForbiddenError(msg string, params ...interface{}) *httputils.JSONClientError

func NewGeneralError

func NewGeneralError(err error) *httputils.JSONClientError

func NewImageNotFoundError

func NewImageNotFoundError(imageId string) *httputils.JSONClientError

func NewInputParameterError

func NewInputParameterError(msg string, params ...interface{}) *httputils.JSONClientError

func NewInsufficientResourceError

func NewInsufficientResourceError(msg string, params ...interface{}) *httputils.JSONClientError

func NewInternalServerError

func NewInternalServerError(msg string, params ...interface{}) *httputils.JSONClientError

func NewInvalidCredentialError

func NewInvalidCredentialError(msg string, params ...interface{}) *httputils.JSONClientError

func NewInvalidStatusError

func NewInvalidStatusError(msg string, params ...interface{}) *httputils.JSONClientError

func NewJsonClientError

func NewJsonClientError(err errors.Error, msg string, params ...interface{}) *httputils.JSONClientError

func NewMissingParameterError

func NewMissingParameterError(paramName string) *httputils.JSONClientError

func NewNoProjectError

func NewNoProjectError(msg string, params ...interface{}) *httputils.JSONClientError

func NewNotAcceptableError

func NewNotAcceptableError(msg string, params ...interface{}) *httputils.JSONClientError

func NewNotEmptyError

func NewNotEmptyError(msg string, params ...interface{}) *httputils.JSONClientError

func NewNotFoundError

func NewNotFoundError(msg string, params ...interface{}) *httputils.JSONClientError

func NewNotImplementedError

func NewNotImplementedError(msg string, params ...interface{}) *httputils.JSONClientError

func NewNotSufficientPrivilegeError

func NewNotSufficientPrivilegeError(msg string, params ...interface{}) *httputils.JSONClientError

func NewNotSupportedError

func NewNotSupportedError(msg string, params ...interface{}) *httputils.JSONClientError

func NewOutOfLimitError

func NewOutOfLimitError(msg string, params ...interface{}) *httputils.JSONClientError

func NewOutOfQuotaError

func NewOutOfQuotaError(msg string, params ...interface{}) *httputils.JSONClientError

func NewOutOfRangeError

func NewOutOfRangeError(msg string, params ...interface{}) *httputils.JSONClientError

func NewOutOfResourceError

func NewOutOfResourceError(msg string, params ...interface{}) *httputils.JSONClientError

func NewPaymentError

func NewPaymentError(msg string, params ...interface{}) *httputils.JSONClientError

func NewPolicyDefinitionError

func NewPolicyDefinitionError(msg string, params ...interface{}) *httputils.JSONClientError

func NewProtectedResourceError

func NewProtectedResourceError(msg string, params ...interface{}) *httputils.JSONClientError

func NewRequireLicenseError

func NewRequireLicenseError(msg string, params ...interface{}) *httputils.JSONClientError

func NewResourceBusyError

func NewResourceBusyError(msg string, params ...interface{}) *httputils.JSONClientError

func NewResourceNotFoundError

func NewResourceNotFoundError(msg string, params ...interface{}) *httputils.JSONClientError

func NewResourceNotFoundError2

func NewResourceNotFoundError2(keyword, id string) *httputils.JSONClientError

func NewResourceNotReadyError

func NewResourceNotReadyError(msg string, params ...interface{}) *httputils.JSONClientError

func NewServerError

func NewServerError(msg string, params ...interface{}) *httputils.JSONClientError

func NewServerStatusError

func NewServerStatusError(msg string, params ...interface{}) *httputils.JSONClientError

func NewServiceAbnormalError

func NewServiceAbnormalError(msg string, params ...interface{}) *httputils.JSONClientError

func NewSpecNotFoundError

func NewSpecNotFoundError(msg string, params ...interface{}) *httputils.JSONClientError

func NewTenantNotFoundError

func NewTenantNotFoundError(msg string, params ...interface{}) *httputils.JSONClientError

func NewTimeoutError

func NewTimeoutError(msg string, params ...interface{}) *httputils.JSONClientError

func NewTooLargeEntityError

func NewTooLargeEntityError(msg string, params ...interface{}) *httputils.JSONClientError

func NewUnauthorizedError

func NewUnauthorizedError(msg string, params ...interface{}) *httputils.JSONClientError

func NewUnclassifiedError

func NewUnclassifiedError(msg string, params ...interface{}) *httputils.JSONClientError

func NewUnsupportOperationError

func NewUnsupportOperationError(msg string, params ...interface{}) *httputils.JSONClientError

func NewUserNotFoundError

func NewUserNotFoundError(msg string, params ...interface{}) *httputils.JSONClientError

func NewWeakPasswordError

func NewWeakPasswordError() *httputils.JSONClientError

func NoProjectError

func NoProjectError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

func NotAcceptableError

func NotAcceptableError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

func NotFoundError

func NotFoundError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

func NotImplementedError

func NotImplementedError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

func NotSufficientPrivilegeError

func NotSufficientPrivilegeError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

func OutOfQuotaError

func OutOfQuotaError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

func PaymentError

func PaymentError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

func ProtectedResourceError

func ProtectedResourceError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

func RegisterErrorHttpCode

func RegisterErrorHttpCode(err errors.Error, code int)

func ResourceNotFoundError

func ResourceNotFoundError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

func SendHTTPErrorHeader

func SendHTTPErrorHeader(w http.ResponseWriter, statusCode int)

func SetHTTPRedirectLocationHeader

func SetHTTPRedirectLocationHeader(w http.ResponseWriter, location string)

func SetTimeZone

func SetTimeZone(tzStr string)

func TenantNotFoundError

func TenantNotFoundError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

func TimeoutError

func TimeoutError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

func UnauthorizedError

func UnauthorizedError(ctx context.Context, w http.ResponseWriter, msg string, params ...interface{})

Types

type Error

type Error struct {
	Code    int    `json:"code,omitzero"`
	Class   string `json:"class,omitempty"`
	Details string `json:"details,omitempty"`
}

func NewErrorFromGeneralError

func NewErrorFromGeneralError(ctx context.Context, e error) Error

func NewErrorFromJCError

func NewErrorFromJCError(ctx context.Context, je *httputils.JSONClientError) Error

Jump to

Keyboard shortcuts

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