Documentation
¶
Index ¶
- func MapAPIError(err error, resp *http.Response) error
- func NewBadRequestError(msg string) badRequestError
- func NewConflictError(msg string) conflictError
- func NewNotFoundError(msg string) notFoundError
- type AuthenticationError
- type EncodingError
- type InvalidStateTransitionError
- type LicenceCapabilityError
- type LockedError
- type ServerError
- type StaleWriteError
- type StoreError
- type UnauthorisedError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MapAPIError ¶
MapAPIError will given err and its corresponding resp attempt to map the HTTP error to an application level error.
err is returned as is when any of the following are true:
→ resp is nil → err is not a GenericOpenAPIError or the unexported openAPIError
Some response codes must be mapped by the caller in order to provide useful application level errors:
→ http.StatusBadRequest returns a badRequestError, which must have a 1-to-1 mapping to a context specific application error → http.StatusNotFound returns a notFoundError, which must have a 1-to-1 mapping to a context specific application error → http.StatusConflict returns a conflictError which must have a 1-to-1 mapping to a context specific application error
func NewBadRequestError ¶
func NewBadRequestError(msg string) badRequestError
func NewConflictError ¶
func NewConflictError(msg string) conflictError
func NewNotFoundError ¶
func NewNotFoundError(msg string) notFoundError
Types ¶
type AuthenticationError ¶
type AuthenticationError struct {
// contains filtered or unexported fields
}
AuthenticationError indicates that the requested operation could not be performed for the client due to an issue with the authentication credentials provided by the client.
func NewAuthenticationError ¶
func NewAuthenticationError(msg string) AuthenticationError
NewAuthenticationError returns a new AuthenticationError using msg as an optional error message if given.
func (AuthenticationError) Error ¶
func (e AuthenticationError) Error() string
type EncodingError ¶
type EncodingError struct {
// contains filtered or unexported fields
}
EncodingError provides a unified error type which transport encoding implementations return when given a value that cannot be encoded with the target encoding.
func NewEncodingError ¶
func NewEncodingError(err error, targetType, value interface{}) EncodingError
NewEncodingError wraps err as an encoding error for value into targetType.
func (EncodingError) Error ¶
func (e EncodingError) Error() string
type InvalidStateTransitionError ¶
type InvalidStateTransitionError struct {
// contains filtered or unexported fields
}
InvalidStateTransitionError indicates that the requested operation cannot be performed for the target resource in its current state.
func NewInvalidStateTransitionError ¶
func NewInvalidStateTransitionError(msg string) InvalidStateTransitionError
NewInvalidStateTransitionError returns a new InvalidStateTransitionError using msg as an optional error message if given.
func (InvalidStateTransitionError) Error ¶
func (e InvalidStateTransitionError) Error() string
type LicenceCapabilityError ¶
type LicenceCapabilityError struct {
// contains filtered or unexported fields
}
LicenceCapabilityError indicates that the requested operation cannot be carried out due to a licensing issue with the cluster.
func NewLicenceCapabilityError ¶
func NewLicenceCapabilityError(msg string) LicenceCapabilityError
NewLicenceCapabilityError returns a new LicenceCapabilityError using msg as an optional error message if given.
func (LicenceCapabilityError) Error ¶
func (e LicenceCapabilityError) Error() string
type LockedError ¶
type LockedError struct {
// contains filtered or unexported fields
}
LockedError indicates that the requested operation cannot be performed because a lock is held for the target resource.
func NewLockedError ¶
func NewLockedError(msg string) LockedError
NewLockedError returns a new LockedError using msg as an optional error message if given.
func (LockedError) Error ¶
func (e LockedError) Error() string
type ServerError ¶
type ServerError struct {
// contains filtered or unexported fields
}
ServerError indicates that an unrecoverable error occurred while attempting to perform the requested operation.
func NewServerError ¶
func NewServerError(msg string) ServerError
NewServerError returns a new ServerError using msg as an optional error message if given.
func (ServerError) Error ¶
func (e ServerError) Error() string
type StaleWriteError ¶
type StaleWriteError struct {
// contains filtered or unexported fields
}
StaleWriteError indicates that the target resource for the requested operation has been concurrently updated, invalidating the request. The client should fetch the latest version of the resource before attempting to perform another update.
func NewStaleWriteError ¶
func NewStaleWriteError(msg string) StaleWriteError
NewStaleWriteError returns a new StaleWriteError using msg as an optional error message if given.
func (StaleWriteError) Error ¶
func (e StaleWriteError) Error() string
type StoreError ¶
type StoreError struct {
// contains filtered or unexported fields
}
StoreError indicates that the requested operation could not be performed due to a store outage.
func NewStoreError ¶
func NewStoreError(msg string) StoreError
NewStoreError returns a new StoreError using msg as an optional error message if given.
func (StoreError) Error ¶
func (e StoreError) Error() string
type UnauthorisedError ¶
type UnauthorisedError struct {
// contains filtered or unexported fields
}
UnauthorisedError indicates that the requested operation is disallowed for the user which the client is authenticated as.
func NewUnauthorisedError ¶
func NewUnauthorisedError(msg string) UnauthorisedError
NewUnauthorisedError returns a new UnauthorisedError using msg as an optional error message if given.
func (UnauthorisedError) Error ¶
func (e UnauthorisedError) Error() string