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 IsInternalError(err error) bool
- func IsInvalid(err error) bool
- func IsMethodNotSupported(err error) bool
- func IsNotFound(err error) bool
- func IsServerTimeout(err error) bool
- func IsTooManyRequests(err error) bool
- func IsUnauthorized(err error) bool
- func IsUnexpectedObjectError(err error) bool
- func IsUnexpectedServerError(err error) bool
- func SuggestsClientDelay(err error) (int, bool)
- type APIStatus
- type StatusError
- func NewAlreadyExists(qualifiedResource unversioned.GroupResource, name string) *StatusError
- func NewBadRequest(reason string) *StatusError
- func NewConflict(qualifiedResource unversioned.GroupResource, name string, err error) *StatusError
- func NewForbidden(qualifiedResource unversioned.GroupResource, name string, err error) *StatusError
- func NewGenericServerResponse(code int, verb string, qualifiedResource unversioned.GroupResource, ...) *StatusError
- func NewGone(message string) *StatusError
- func NewInternalError(err error) *StatusError
- func NewInvalid(qualifiedKind unversioned.GroupKind, name string, errs field.ErrorList) *StatusError
- func NewMethodNotSupported(qualifiedResource unversioned.GroupResource, action string) *StatusError
- func NewNotFound(qualifiedResource unversioned.GroupResource, name string) *StatusError
- func NewServerTimeout(qualifiedResource unversioned.GroupResource, operation string, ...) *StatusError
- func NewServerTimeoutForKind(qualifiedKind unversioned.GroupKind, operation string, retryAfterSeconds int) *StatusError
- func NewServiceUnavailable(reason string) *StatusError
- func NewTimeoutError(message string, retryAfterSeconds int) *StatusError
- func NewUnauthorized(reason string) *StatusError
- type UnexpectedObjectError
Constants ¶
const ( StatusUnprocessableEntity = 422 StatusTooManyRequests = 429 // StatusServerTimeout is an indication that a transient server error has // occurred and the client *should* retry, with an optional Retry-After // header to specify the back off window. StatusServerTimeout = 504 )
HTTP Status codes not in the golang http package.
Variables ¶
This section is empty.
Functions ¶
func FromObject ¶
FromObject generates an StatusError from an unversioned.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 ¶ added in v0.5.1
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 ¶ added in v0.10.0
IsForbidden determines if err is an error which indicates that the request is forbidden and cannot be completed as requested.
func IsInternalError ¶ added in v1.5.0
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 ¶ added in v0.9.0
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 IsNotFound ¶
IsNotFound returns true if the specified error was created by NewNotFound.
func IsServerTimeout ¶ added in v0.12.0
IsServerTimeout determines if err is an error which indicates that the request needs to be retried by the client.
func IsTooManyRequests ¶ added in v1.5.0
IsTooManyRequests determines if err is an error which indicates that there are too many requests that the server cannot handle. TODO: update IsTooManyRequests() when the TooManyRequests(429) error returned from the API server has a non-empty Reason field
func IsUnauthorized ¶ added in v0.14.0
IsUnauthorized determines if err is an error which indicates that the request is unauthorized and requires authentication by the user.
func IsUnexpectedObjectError ¶ added in v0.13.0
IsUnexpectedObjectError determines if err is due to an unexpected object from the master.
func IsUnexpectedServerError ¶ added in v0.15.0
IsUnexpectedServerError returns true if the server response was not in the expected API format, and may be the result of another HTTP actor.
func SuggestsClientDelay ¶ added in v0.14.0
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.
Types ¶
type APIStatus ¶ added in v1.2.0
type APIStatus interface {
Status() unversioned.Status
}
APIStatus is exposed by errors that can be converted to an api.Status object for finer grained details.
type StatusError ¶ added in v0.6.0
type StatusError struct {
ErrStatus unversioned.Status
}
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 unversioned.GroupResource, name string) *StatusError
NewAlreadyExists returns an error indicating the item requested exists by that identifier.
func NewBadRequest ¶ added in v0.5.1
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 unversioned.GroupResource, name string, err error) *StatusError
NewConflict returns an error indicating the item can't be updated as provided.
func NewForbidden ¶ added in v0.9.0
func NewForbidden(qualifiedResource unversioned.GroupResource, name string, err error) *StatusError
NewForbidden returns an error indicating the requested action was forbidden
func NewGenericServerResponse ¶ added in v0.15.0
func NewGenericServerResponse(code int, verb string, qualifiedResource unversioned.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 ¶ added in v1.2.0
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 ¶ added in v0.5.1
func NewInternalError(err error) *StatusError
NewInternalError returns an error indicating the item is invalid and cannot be processed.
func NewInvalid ¶
func NewInvalid(qualifiedKind unversioned.GroupKind, name string, errs field.ErrorList) *StatusError
NewInvalid returns an error indicating the item is invalid and cannot be processed.
func NewMethodNotSupported ¶ added in v0.9.0
func NewMethodNotSupported(qualifiedResource unversioned.GroupResource, action string) *StatusError
NewMethodNotSupported returns an error indicating the requested action is not supported on this kind.
func NewNotFound ¶
func NewNotFound(qualifiedResource unversioned.GroupResource, name string) *StatusError
NewNotFound returns a new error which indicates that the resource of the kind and the name was not found.
func NewServerTimeout ¶ added in v0.12.0
func NewServerTimeout(qualifiedResource unversioned.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 ¶ added in v1.2.0
func NewServerTimeoutForKind(qualifiedKind unversioned.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 ¶ added in v1.1.0
func NewServiceUnavailable(reason string) *StatusError
NewServiceUnavailable creates an error that indicates that the requested service is unavailable.
func NewTimeoutError ¶ added in v0.12.0
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 NewUnauthorized ¶ added in v0.14.0
func NewUnauthorized(reason string) *StatusError
NewUnauthorized returns an error indicating the client is not authorized to perform the requested action.
func (*StatusError) DebugError ¶ added in v0.15.0
func (e *StatusError) DebugError() (string, []interface{})
DebugError reports extended info about the error to debug output.
func (*StatusError) Error ¶ added in v0.6.0
func (e *StatusError) Error() string
Error implements the Error interface.
func (*StatusError) Status ¶ added in v0.6.0
func (e *StatusError) Status() unversioned.Status
Status allows access to e's status without having to know the detailed workings of StatusError. Used by pkg/apiserver.
type UnexpectedObjectError ¶ added in v0.6.0
UnexpectedObjectError can be returned by FromObject if it's passed a non-status object.
func (*UnexpectedObjectError) Error ¶ added in v0.6.0
func (u *UnexpectedObjectError) Error() string
Error returns an error message describing 'u'.