Documentation ¶
Overview ¶
Package errors provides error interfaces and utility functions for all packages.
Index ¶
- func CheckAPIError(r *http.Response) error
- func IsAPIForbidden(err error) bool
- func IsAPINotFound(err error) bool
- func IsAPIServerError(err error) bool
- func IsAPIUnauthorized(err error) bool
- func IsBrokenPipeError(err error) bool
- func IsRoleNotFoundError(err error) bool
- func IsSecretNotFoundError(err error) bool
- func IsUserNotFoundError(err error) bool
- func New(msg string) error
- func NewRoleNotFoundError(role string) error
- func NewSecretNotFoundError(secret string) error
- func NewUserNotFoundError(user string) error
- type APIError
- type ErrorStatus
- type RequeueError
- type RoleNotFoundError
- type SecretNotFoundError
- type UserNotFoundError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAPIError ¶
CheckAPIError evaluates if the HTTP response contains an API error. If so, an attempt is made to unmarshal it into an API error. If this fails, then an error containing the original body is returned, or any error from attempting to read the body.
func IsAPIForbidden ¶
IsAPIForbidden checks if the given error from the API is a Forbidden error.
func IsAPINotFound ¶
IsAPINotFound checks if the given error from the API is a NotFound error.
func IsAPIServerError ¶
IsAPIServerError checks if the given error from the API is a ServerError error.
func IsAPIUnauthorized ¶
IsAPIUnauthorized checks if the given error from the API is a Unauthorized error.
func IsBrokenPipeError ¶
IsBrokenPipeError returns true if the error is from trying to write to a closed connection.
func IsRoleNotFoundError ¶
IsRoleNotFoundError returns true if the given error interface is a RoleNotFoundError.
func IsSecretNotFoundError ¶
IsSecretNotFoundError returns true if the given error is a SecretNotFoundError.
func IsUserNotFoundError ¶
IsUserNotFoundError returns true if the given error interface is a UserNotFoundError.
func NewRoleNotFoundError ¶
NewRoleNotFoundError returns a new RoleNotFoundError for the provided role.
func NewSecretNotFoundError ¶
NewSecretNotFoundError returns a new SecretNotFoundError for the given resource name.
func NewUserNotFoundError ¶
NewUserNotFoundError returns a new UserNotFoundError for the provided username.
Types ¶
type APIError ¶
type APIError struct { // A message describing the error ErrMsg string `json:"error"` // The status for the error. ErrStatus ErrorStatus `json:"status"` }
APIError is for errors from the API server. It's main purpose is to provide a quick interface for returning json encoded error messages
func ToAPIError ¶
func ToAPIError(err error, errStatus ErrorStatus) *APIError
ToAPIError converts a generic error into an API error
type ErrorStatus ¶
type ErrorStatus string
ErrorStatus represents a type of API error
const ( Forbidden ErrorStatus = "Forbidden" NotFound ErrorStatus = "NotFound" ServerError ErrorStatus = "ServerError" )
Error types
type RequeueError ¶
type RequeueError struct {
// contains filtered or unexported fields
}
RequeueError is used to float errors back up to the controller signalling that an error has not actually ocurred, but instead the reconcile attempt should be requeued due to a resource not being ready.
func IsRequeueError ¶
func IsRequeueError(err error) (*RequeueError, bool)
IsRequeueError returns true if the provided error interface is a RequeueError. If it is a requeue error, return the underlying object.
func NewRequeueError ¶
func NewRequeueError(msg string, requeueSeconds int) *RequeueError
NewRequeueError returns a new requeue error. The provided string will be logged, and the reconcile will be requeued after the given number of seconds.
func (*RequeueError) Duration ¶
func (r *RequeueError) Duration() time.Duration
Duration returns the wait time for this error
func (*RequeueError) Error ¶
func (r *RequeueError) Error() string
Error implements the error interface
type RoleNotFoundError ¶
type RoleNotFoundError struct {
// contains filtered or unexported fields
}
RoleNotFoundError is an error signaling that the requested role was not found.
func (*RoleNotFoundError) Error ¶
func (r *RoleNotFoundError) Error() string
Error implements the error interface.
type SecretNotFoundError ¶
type SecretNotFoundError struct {
// contains filtered or unexported fields
}
SecretNotFoundError is used to signal from a secrets backend that the requested secret does not exist.
func (*SecretNotFoundError) Error ¶
func (r *SecretNotFoundError) Error() string
Error implements the error interface
type UserNotFoundError ¶
type UserNotFoundError struct {
// contains filtered or unexported fields
}
UserNotFoundError is an error signaling that the requested user was not found.
func (*UserNotFoundError) Error ¶
func (r *UserNotFoundError) Error() string
Error implements the error interface.