errors

package
v0.13.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsUnprocessableEntity

func AsUnprocessableEntity(err error, detail string, errTypes ...ApiError) error

func DropletForbiddenAsNotFound

func DropletForbiddenAsNotFound(err error) error

DropletForbiddenAsNotFound is a special case due to the CF CLI expecting the error message "Droplet not found" exactly instead of the generic case https://github.com/cloudfoundry/korifi/issues/965

func ForbiddenAsNotFound

func ForbiddenAsNotFound(err error) error

func FromK8sError

func FromK8sError(err error, resourceType string) error

func LogAndReturn

func LogAndReturn(logger logr.Logger, err error, msg string, keysAndValues ...interface{}) error

LogAndReturn logs api errors at the info level and other errors at the error level since api errors are expected recoverable conditions. It returns the error for convenience.

Types

type ApiError

type ApiError interface {
	Detail() string
	Title() string
	Code() int
	HttpStatus() int
	Unwrap() error
	Error() string
}

type BadQueryParamValueError

type BadQueryParamValueError struct {
	// contains filtered or unexported fields
}

func NewBadQueryParamValueError

func NewBadQueryParamValueError(key string, validValues ...string) BadQueryParamValueError

func (BadQueryParamValueError) Code

func (e BadQueryParamValueError) Code() int

func (BadQueryParamValueError) Detail

func (e BadQueryParamValueError) Detail() string

func (BadQueryParamValueError) Error

func (e BadQueryParamValueError) Error() string

func (BadQueryParamValueError) HttpStatus

func (e BadQueryParamValueError) HttpStatus() int

func (BadQueryParamValueError) Title

func (e BadQueryParamValueError) Title() string

func (BadQueryParamValueError) Unwrap

func (e BadQueryParamValueError) Unwrap() error

type BlobstoreUnavailableError

type BlobstoreUnavailableError struct {
	// contains filtered or unexported fields
}

func NewBlobstoreUnavailableError

func NewBlobstoreUnavailableError(cause error) BlobstoreUnavailableError

func (BlobstoreUnavailableError) Code

func (e BlobstoreUnavailableError) Code() int

func (BlobstoreUnavailableError) Detail

func (e BlobstoreUnavailableError) Detail() string

func (BlobstoreUnavailableError) Error

func (e BlobstoreUnavailableError) Error() string

func (BlobstoreUnavailableError) HttpStatus

func (e BlobstoreUnavailableError) HttpStatus() int

func (BlobstoreUnavailableError) Title

func (e BlobstoreUnavailableError) Title() string

func (BlobstoreUnavailableError) Unwrap

func (e BlobstoreUnavailableError) Unwrap() error

type EndpointNotFoundError added in v0.7.0

type EndpointNotFoundError struct {
	// contains filtered or unexported fields
}

func NewEndpointNotFoundError added in v0.7.0

func NewEndpointNotFoundError() EndpointNotFoundError

func (EndpointNotFoundError) Code added in v0.7.0

func (e EndpointNotFoundError) Code() int

func (EndpointNotFoundError) Detail added in v0.7.0

func (e EndpointNotFoundError) Detail() string

func (EndpointNotFoundError) Error added in v0.7.0

func (e EndpointNotFoundError) Error() string

func (EndpointNotFoundError) HttpStatus added in v0.7.0

func (e EndpointNotFoundError) HttpStatus() int

func (EndpointNotFoundError) Title added in v0.7.0

func (e EndpointNotFoundError) Title() string

func (EndpointNotFoundError) Unwrap added in v0.7.0

func (e EndpointNotFoundError) Unwrap() error

type ForbiddenError

type ForbiddenError struct {
	// contains filtered or unexported fields
}

func NewForbiddenError

func NewForbiddenError(cause error, resourceType string) ForbiddenError

func (ForbiddenError) Code

func (e ForbiddenError) Code() int

func (ForbiddenError) Detail

func (e ForbiddenError) Detail() string

func (ForbiddenError) Error

func (e ForbiddenError) Error() string

func (ForbiddenError) HttpStatus

func (e ForbiddenError) HttpStatus() int

func (ForbiddenError) ResourceType

func (e ForbiddenError) ResourceType() string

func (ForbiddenError) Title

func (e ForbiddenError) Title() string

func (ForbiddenError) Unwrap

func (e ForbiddenError) Unwrap() error

type InvalidAuthError

type InvalidAuthError struct {
	// contains filtered or unexported fields
}

func NewInvalidAuthError

func NewInvalidAuthError(cause error) InvalidAuthError

func (InvalidAuthError) Code

func (e InvalidAuthError) Code() int

func (InvalidAuthError) Detail

func (e InvalidAuthError) Detail() string

func (InvalidAuthError) Error

func (e InvalidAuthError) Error() string

func (InvalidAuthError) HttpStatus

func (e InvalidAuthError) HttpStatus() int

func (InvalidAuthError) Title

func (e InvalidAuthError) Title() string

func (InvalidAuthError) Unwrap

func (e InvalidAuthError) Unwrap() error

type InvalidRequestError

type InvalidRequestError struct {
	// contains filtered or unexported fields
}

func NewInvalidRequestError

func NewInvalidRequestError(cause error, detail string) InvalidRequestError

func (InvalidRequestError) Code

func (e InvalidRequestError) Code() int

func (InvalidRequestError) Detail

func (e InvalidRequestError) Detail() string

func (InvalidRequestError) Error

func (e InvalidRequestError) Error() string

func (InvalidRequestError) HttpStatus

func (e InvalidRequestError) HttpStatus() int

func (InvalidRequestError) Title

func (e InvalidRequestError) Title() string

func (InvalidRequestError) Unwrap

func (e InvalidRequestError) Unwrap() error

type MessageParseError

type MessageParseError struct {
	// contains filtered or unexported fields
}

func NewMessageParseError

func NewMessageParseError(cause error) MessageParseError

func (MessageParseError) Code

func (e MessageParseError) Code() int

func (MessageParseError) Detail

func (e MessageParseError) Detail() string

func (MessageParseError) Error

func (e MessageParseError) Error() string

func (MessageParseError) HttpStatus

func (e MessageParseError) HttpStatus() int

func (MessageParseError) Title

func (e MessageParseError) Title() string

func (MessageParseError) Unwrap

func (e MessageParseError) Unwrap() error

type NotAuthenticatedError

type NotAuthenticatedError struct {
	// contains filtered or unexported fields
}

func NewNotAuthenticatedError

func NewNotAuthenticatedError(cause error) NotAuthenticatedError

func (NotAuthenticatedError) Code

func (e NotAuthenticatedError) Code() int

func (NotAuthenticatedError) Detail

func (e NotAuthenticatedError) Detail() string

func (NotAuthenticatedError) Error

func (e NotAuthenticatedError) Error() string

func (NotAuthenticatedError) HttpStatus

func (e NotAuthenticatedError) HttpStatus() int

func (NotAuthenticatedError) Title

func (e NotAuthenticatedError) Title() string

func (NotAuthenticatedError) Unwrap

func (e NotAuthenticatedError) Unwrap() error

type NotFoundError

type NotFoundError struct {
	// contains filtered or unexported fields
}

func NewNotFoundError

func NewNotFoundError(cause error, resourceType string, additionalDetails ...string) NotFoundError

func (NotFoundError) Code

func (e NotFoundError) Code() int

func (NotFoundError) Detail

func (e NotFoundError) Detail() string

func (NotFoundError) Error

func (e NotFoundError) Error() string

func (NotFoundError) HttpStatus

func (e NotFoundError) HttpStatus() int

func (NotFoundError) Title

func (e NotFoundError) Title() string

func (NotFoundError) Unwrap

func (e NotFoundError) Unwrap() error

type PackageBitsAlreadyUploadedError

type PackageBitsAlreadyUploadedError struct {
	// contains filtered or unexported fields
}

func NewPackageBitsAlreadyUploadedError

func NewPackageBitsAlreadyUploadedError(cause error) PackageBitsAlreadyUploadedError

func (PackageBitsAlreadyUploadedError) Code

func (e PackageBitsAlreadyUploadedError) Code() int

func (PackageBitsAlreadyUploadedError) Detail

func (e PackageBitsAlreadyUploadedError) Detail() string

func (PackageBitsAlreadyUploadedError) Error

func (e PackageBitsAlreadyUploadedError) Error() string

func (PackageBitsAlreadyUploadedError) HttpStatus

func (e PackageBitsAlreadyUploadedError) HttpStatus() int

func (PackageBitsAlreadyUploadedError) Title

func (e PackageBitsAlreadyUploadedError) Title() string

func (PackageBitsAlreadyUploadedError) Unwrap

func (e PackageBitsAlreadyUploadedError) Unwrap() error

type ResourceNotReadyError added in v0.7.0

type ResourceNotReadyError struct {
	// contains filtered or unexported fields
}

func NewResourceNotReadyError added in v0.7.0

func NewResourceNotReadyError(cause error) ResourceNotReadyError

func (ResourceNotReadyError) Code added in v0.7.0

func (e ResourceNotReadyError) Code() int

func (ResourceNotReadyError) Detail added in v0.7.0

func (e ResourceNotReadyError) Detail() string

func (ResourceNotReadyError) Error added in v0.7.0

func (e ResourceNotReadyError) Error() string

func (ResourceNotReadyError) HttpStatus added in v0.7.0

func (e ResourceNotReadyError) HttpStatus() int

func (ResourceNotReadyError) Title added in v0.7.0

func (e ResourceNotReadyError) Title() string

func (ResourceNotReadyError) Unwrap added in v0.7.0

func (e ResourceNotReadyError) Unwrap() error

type RollingDeployNotSupportedError added in v0.8.0

type RollingDeployNotSupportedError struct {
	// contains filtered or unexported fields
}

func NewRollingDeployNotSupportedError added in v0.8.0

func NewRollingDeployNotSupportedError(runnerName string) RollingDeployNotSupportedError

func (RollingDeployNotSupportedError) Code added in v0.8.0

func (e RollingDeployNotSupportedError) Code() int

func (RollingDeployNotSupportedError) Detail added in v0.8.0

func (e RollingDeployNotSupportedError) Detail() string

func (RollingDeployNotSupportedError) Error added in v0.8.0

func (e RollingDeployNotSupportedError) Error() string

func (RollingDeployNotSupportedError) HttpStatus added in v0.8.0

func (e RollingDeployNotSupportedError) HttpStatus() int

func (RollingDeployNotSupportedError) Title added in v0.8.0

func (e RollingDeployNotSupportedError) Title() string

func (RollingDeployNotSupportedError) Unwrap added in v0.8.0

func (e RollingDeployNotSupportedError) Unwrap() error

type UniquenessError

type UniquenessError struct {
	// contains filtered or unexported fields
}

func NewUniquenessError

func NewUniquenessError(cause error, detail string) UniquenessError

func (UniquenessError) Code

func (e UniquenessError) Code() int

func (UniquenessError) Detail

func (e UniquenessError) Detail() string

func (UniquenessError) Error

func (e UniquenessError) Error() string

func (UniquenessError) HttpStatus

func (e UniquenessError) HttpStatus() int

func (UniquenessError) Title

func (e UniquenessError) Title() string

func (UniquenessError) Unwrap

func (e UniquenessError) Unwrap() error

type UnknownError

type UnknownError struct {
	// contains filtered or unexported fields
}

UnknownError is a generic wrapper over an error Korifi cannot recover from. Unknown errors should be only used by the presentation layer to present such an error to the user. Other components (handlers, repositories, etc.) should simply return the incoming error, it would be mapped to `UnknownError` by the presentation layer

func NewUnknownError

func NewUnknownError(cause error) UnknownError

NewUnknownError creates an UnknownError. One should generally not create unknown errors as generic errors are automatically presented as unknown errors to the user

func (UnknownError) Code

func (e UnknownError) Code() int

func (UnknownError) Detail

func (e UnknownError) Detail() string

func (UnknownError) Error

func (e UnknownError) Error() string

func (UnknownError) HttpStatus

func (e UnknownError) HttpStatus() int

func (UnknownError) Title

func (e UnknownError) Title() string

func (UnknownError) Unwrap

func (e UnknownError) Unwrap() error

type UnknownKeyError

type UnknownKeyError struct {
	// contains filtered or unexported fields
}

func NewUnknownKeyError

func NewUnknownKeyError(cause error, validKeys []string) UnknownKeyError

func (UnknownKeyError) Code

func (e UnknownKeyError) Code() int

func (UnknownKeyError) Detail

func (e UnknownKeyError) Detail() string

func (UnknownKeyError) Error

func (e UnknownKeyError) Error() string

func (UnknownKeyError) HttpStatus

func (e UnknownKeyError) HttpStatus() int

func (UnknownKeyError) Title

func (e UnknownKeyError) Title() string

func (UnknownKeyError) Unwrap

func (e UnknownKeyError) Unwrap() error

type UnprocessableEntityError

type UnprocessableEntityError struct {
	// contains filtered or unexported fields
}

func NewUnprocessableEntityError

func NewUnprocessableEntityError(cause error, detail string) UnprocessableEntityError

func (UnprocessableEntityError) Code

func (e UnprocessableEntityError) Code() int

func (UnprocessableEntityError) Detail

func (e UnprocessableEntityError) Detail() string

func (UnprocessableEntityError) Error

func (e UnprocessableEntityError) Error() string

func (UnprocessableEntityError) HttpStatus

func (e UnprocessableEntityError) HttpStatus() int

func (UnprocessableEntityError) Title

func (e UnprocessableEntityError) Title() string

func (UnprocessableEntityError) Unwrap

func (e UnprocessableEntityError) Unwrap() error

Jump to

Keyboard shortcuts

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