apierrors

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 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 added in v0.2.0

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 BlobstoreUnavailableError added in v0.3.0

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

func NewBlobstoreUnavailableError added in v0.3.0

func NewBlobstoreUnavailableError(cause error) BlobstoreUnavailableError

func (BlobstoreUnavailableError) Code added in v0.3.0

func (e BlobstoreUnavailableError) Code() int

func (BlobstoreUnavailableError) Detail added in v0.3.0

func (e BlobstoreUnavailableError) Detail() string

func (BlobstoreUnavailableError) Error added in v0.3.0

func (e BlobstoreUnavailableError) Error() string

func (BlobstoreUnavailableError) HttpStatus added in v0.3.0

func (e BlobstoreUnavailableError) HttpStatus() int

func (BlobstoreUnavailableError) Title added in v0.3.0

func (e BlobstoreUnavailableError) Title() string

func (BlobstoreUnavailableError) Unwrap added in v0.3.0

func (e BlobstoreUnavailableError) 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) 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 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