Documentation ¶
Overview ¶
Package errors provides detailed error types for api field validation.
Index ¶
- Constants
- func FromObject(obj runtime.Object) error
- func IsAlreadyExists(err error) bool
- func IsBadRequest(err error) bool
- func IsConflict(err error) bool
- func IsForbidden(err error) bool
- func IsGone(err error) bool
- func IsInternalError(err error) bool
- func IsInvalid(err error) bool
- func IsMethodNotSupported(err error) bool
- func IsNotAcceptable(err error) bool
- func IsNotFound(err error) bool
- func IsRequestEntityTooLargeError(err error) bool
- func IsResourceExpired(err error) bool
- func IsServerTimeout(err error) bool
- func IsServiceUnavailable(err error) bool
- func IsTimeout(err error) bool
- func IsTooManyRequests(err error) bool
- func IsUnauthorized(err error) bool
- func IsUnexpectedObjectError(err error) bool
- func IsUnexpectedServerError(err error) bool
- func IsUnsupportedMediaType(err error) bool
- func ReasonForError(err error) metav1.StatusReason
- func SuggestsClientDelay(err error) (int, bool)
- type APIStatus
- type StatusError
- func NewAlreadyExists(qualifiedResource schema.GroupResource, name string) *StatusError
- func NewBadRequest(reason string) *StatusError
- func NewConflict(qualifiedResource schema.GroupResource, name string, err error) *StatusError
- func NewForbidden(qualifiedResource schema.GroupResource, name string, err error) *StatusError
- func NewGenericServerResponse(code int, verb string, qualifiedResource schema.GroupResource, ...) *StatusError
- func NewGone(message string) *StatusError
- func NewInternalError(err error) *StatusError
- func NewInvalid(qualifiedKind schema.GroupKind, name string, errs field.ErrorList) *StatusError
- func NewMethodNotSupported(qualifiedResource schema.GroupResource, action string) *StatusError
- func NewNotFound(qualifiedResource schema.GroupResource, name string) *StatusError
- func NewRequestEntityTooLargeError(message string) *StatusError
- func NewResourceExpired(message string) *StatusError
- func NewServerTimeout(qualifiedResource schema.GroupResource, operation string, ...) *StatusError
- func NewServerTimeoutForKind(qualifiedKind schema.GroupKind, operation string, retryAfterSeconds int) *StatusError
- func NewServiceUnavailable(reason string) *StatusError
- func NewTimeoutError(message string, retryAfterSeconds int) *StatusError
- func NewTooManyRequests(message string, retryAfterSeconds int) *StatusError
- func NewTooManyRequestsError(message string) *StatusError
- func NewUnauthorized(reason string) *StatusError
- type UnexpectedObjectError
Constants ¶
const ( // StatusTooManyRequests means the server experienced too many requests within a // given window and that the client must wait to perform the action again. StatusTooManyRequests = 429 )
Variables ¶
This section is empty.
Functions ¶
func FromObject ¶
FromObject generates an StatusError from an metav1.Status, if that is the type of obj; otherwise, returns an UnexpecteObjectError.
func IsAlreadyExists ¶
IsAlreadyExists determines if the err is an error which indicates that a specified resource already exists.
func IsBadRequest ¶
IsBadRequest determines if err is an error which indicates that the request is invalid.
func IsConflict ¶
IsConflict determines if the err is an error which indicates the provided update conflicts.
func IsForbidden ¶
IsForbidden determines if err is an error which indicates that the request is forbidden and cannot be completed as requested.
func IsInternalError ¶
IsInternalError determines if err is an error which indicates an internal server error.
func IsInvalid ¶
IsInvalid determines if the err is an error which indicates the provided resource is not valid.
func IsMethodNotSupported ¶
IsMethodNotSupported determines if the err is an error which indicates the provided action could not be performed because it is not supported by the server.
func IsNotAcceptable ¶
IsNotAcceptable determines if err is an error which indicates that the request failed due to an invalid Accept header
func IsNotFound ¶
IsNotFound returns true if the specified error was created by NewNotFound.
func IsRequestEntityTooLargeError ¶
IsRequestEntityTooLargeError determines if err is an error which indicates the request entity is too large.
func IsResourceExpired ¶
IsResourceExpired is true if the error indicates the resource has expired and the current action is no longer possible.
func IsServerTimeout ¶
IsServerTimeout determines if err is an error which indicates that the request needs to be retried by the client.
func IsServiceUnavailable ¶
IsServiceUnavailable is true if the error indicates the underlying service is no longer available.
func IsTimeout ¶
IsTimeout determines if err is an error which indicates that request times out due to long processing.
func IsTooManyRequests ¶
IsTooManyRequests determines if err is an error which indicates that there are too many requests that the server cannot handle.
func IsUnauthorized ¶
IsUnauthorized determines if err is an error which indicates that the request is unauthorized and requires authentication by the user.
func IsUnexpectedObjectError ¶
IsUnexpectedObjectError determines if err is due to an unexpected object from the master.
func IsUnexpectedServerError ¶
IsUnexpectedServerError returns true if the server response was not in the expected API format, and may be the result of another HTTP actor.
func IsUnsupportedMediaType ¶
IsUnsupportedMediaType determines if err is an error which indicates that the request failed due to an invalid Content-Type header
func ReasonForError ¶
func ReasonForError(err error) metav1.StatusReason
ReasonForError returns the HTTP status for a particular error.
func SuggestsClientDelay ¶
SuggestsClientDelay returns true if this error suggests a client delay as well as the suggested seconds to wait, or false if the error does not imply a wait. It does not address whether the error *should* be retried, since some errors (like a 3xx) may request delay without retry.
Types ¶
type APIStatus ¶
APIStatus is exposed by errors that can be converted to an api.Status object for finer grained details.
type StatusError ¶
StatusError is an error intended for consumption by a REST API server; it can also be reconstructed by clients from a REST response. Public to allow easy type switches.
func NewAlreadyExists ¶
func NewAlreadyExists(qualifiedResource schema.GroupResource, name string) *StatusError
NewAlreadyExists returns an error indicating the item requested exists by that identifier.
func NewBadRequest ¶
func NewBadRequest(reason string) *StatusError
NewBadRequest creates an error that indicates that the request is invalid and can not be processed.
func NewConflict ¶
func NewConflict(qualifiedResource schema.GroupResource, name string, err error) *StatusError
NewConflict returns an error indicating the item can't be updated as provided.
func NewForbidden ¶
func NewForbidden(qualifiedResource schema.GroupResource, name string, err error) *StatusError
NewForbidden returns an error indicating the requested action was forbidden
func NewGenericServerResponse ¶
func NewGenericServerResponse(code int, verb string, qualifiedResource schema.GroupResource, name, serverMessage string, retryAfterSeconds int, isUnexpectedResponse bool) *StatusError
NewGenericServerResponse returns a new error for server responses that are not in a recognizable form.
func NewGone ¶
func NewGone(message string) *StatusError
NewGone returns an error indicating the item no longer available at the server and no forwarding address is known.
func NewInternalError ¶
func NewInternalError(err error) *StatusError
NewInternalError returns an error indicating the item is invalid and cannot be processed.
func NewInvalid ¶
NewInvalid returns an error indicating the item is invalid and cannot be processed.
func NewMethodNotSupported ¶
func NewMethodNotSupported(qualifiedResource schema.GroupResource, action string) *StatusError
NewMethodNotSupported returns an error indicating the requested action is not supported on this kind.
func NewNotFound ¶
func NewNotFound(qualifiedResource schema.GroupResource, name string) *StatusError
NewNotFound returns a new error which indicates that the resource of the kind and the name was not found.
func NewRequestEntityTooLargeError ¶
func NewRequestEntityTooLargeError(message string) *StatusError
NewRequestEntityTooLargeError returns an error indicating that the request entity was too large.
func NewResourceExpired ¶
func NewResourceExpired(message string) *StatusError
NewResourceExpired creates an error that indicates that the requested resource content has expired from the server (usually due to a resourceVersion that is too old).
func NewServerTimeout ¶
func NewServerTimeout(qualifiedResource schema.GroupResource, operation string, retryAfterSeconds int) *StatusError
NewServerTimeout returns an error indicating the requested action could not be completed due to a transient error, and the client should try again.
func NewServerTimeoutForKind ¶
func NewServerTimeoutForKind(qualifiedKind schema.GroupKind, operation string, retryAfterSeconds int) *StatusError
NewServerTimeoutForKind should not exist. Server timeouts happen when accessing resources, the Kind is just what we happened to be looking at when the request failed. This delegates to keep code sane, but we should work towards removing this.
func NewServiceUnavailable ¶
func NewServiceUnavailable(reason string) *StatusError
NewServiceUnavailable creates an error that indicates that the requested service is unavailable.
func NewTimeoutError ¶
func NewTimeoutError(message string, retryAfterSeconds int) *StatusError
NewTimeoutError returns an error indicating that a timeout occurred before the request could be completed. Clients may retry, but the operation may still complete.
func NewTooManyRequests ¶
func NewTooManyRequests(message string, retryAfterSeconds int) *StatusError
NewTooManyRequests creates an error that indicates that the client must try again later because the specified endpoint is not accepting requests. More specific details should be provided if client should know why the failure was limited4.
func NewTooManyRequestsError ¶
func NewTooManyRequestsError(message string) *StatusError
NewTooManyRequestsError returns an error indicating that the request was rejected because the server has received too many requests. Client should wait and retry. But if the request is perishable, then the client should not retry the request.
func NewUnauthorized ¶
func NewUnauthorized(reason string) *StatusError
NewUnauthorized returns an error indicating the client is not authorized to perform the requested action.
func (*StatusError) DebugError ¶
func (e *StatusError) DebugError() (string, []interface{})
DebugError reports extended info about the error to debug output.
func (*StatusError) Error ¶
func (e *StatusError) Error() string
Error implements the Error interface.
func (*StatusError) Status ¶
func (e *StatusError) Status() metav1.Status
Status allows access to e's status without having to know the detailed workings of StatusError.
type UnexpectedObjectError ¶
UnexpectedObjectError can be returned by FromObject if it's passed a non-status object.
func (*UnexpectedObjectError) Error ¶
func (u *UnexpectedObjectError) Error() string
Error returns an error message describing 'u'.