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 IsInvalid(err error) bool
- func IsMethodNotSupported(err error) bool
- func IsNotFound(err error) bool
- func IsServerTimeout(err error) bool
- func IsStatusError(err error) bool
- func IsUnexpectedObjectError(err error) bool
- func NewAlreadyExists(kind, name string) error
- func NewBadRequest(reason string) error
- func NewConflict(kind, name string, err error) error
- func NewForbidden(kind, name string, err error) error
- func NewInternalError(err error) error
- func NewInvalid(kind, name string, errs fielderrors.ValidationErrorList) error
- func NewMethodNotSupported(kind, action string) error
- func NewNotFound(kind, name string) error
- func NewServerTimeout(kind, operation string) error
- func NewTimeoutError(message string) error
- type StatusError
- type UnexpectedObjectError
Constants ¶
const ( StatusUnprocessableEntity = 422 StatusTooManyRequests = 429 // HTTP recommendations are for servers to define 5xx error codes // for scenarios not covered by behavior. In this case, ServerTimeout // is an indication that a transient server error has occured 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 api.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.2.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.3.1
IsForbidden determines if err is an error which indicates that the request is forbidden and cannot be completed as requested.
func IsInvalid ¶
IsInvalid determines if the err is an error which indicates the provided resource is not valid.
func IsMethodNotSupported ¶ added in v0.2.1
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 NewNotFoundErr.
func IsServerTimeout ¶ added in v0.3.2
IsServerTimeout determines if err is an error which indicates that the request needs to be retried by the client.
func IsStatusError ¶ added in v0.4.2
IsStatusError determines if err is an API Status error received from the master.
func IsUnexpectedObjectError ¶ added in v0.4.2
IsUnexpectedObjectError determines if err is due to an unexpected object from the master.
func NewAlreadyExists ¶
NewAlreadyExists returns an error indicating the item requested exists by that identifier.
func NewBadRequest ¶ added in v0.2.1
NewBadRequest creates an error that indicates that the request is invalid and can not be processed.
func NewConflict ¶
NewConflict returns an error indicating the item can't be updated as provided.
func NewForbidden ¶ added in v0.2.1
NewForbidden returns an error indicating the requested action was forbidden
func NewInternalError ¶ added in v0.2.1
NewInternalError returns an error indicating the item is invalid and cannot be processed.
func NewInvalid ¶
func NewInvalid(kind, name string, errs fielderrors.ValidationErrorList) error
NewInvalid returns an error indicating the item is invalid and cannot be processed.
func NewMethodNotSupported ¶ added in v0.2.1
NewMethodNotSupported returns an error indicating the requested action is not supported on this kind.
func NewNotFound ¶
NewNotFound returns a new error which indicates that the resource of the kind and the name was not found.
func NewServerTimeout ¶ added in v0.3.2
NewServerTimeout returns an error indicating the requested action could not be completed due to a transient error, and the client should try again.
func NewTimeoutError ¶ added in v0.3.2
NewTimeoutError returns an error indicating that a timeout occurred before the request could be completed. Clients may retry, but the operation may still complete.
Types ¶
type StatusError ¶ added in v0.2.1
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 (*StatusError) Error ¶ added in v0.2.1
func (e *StatusError) Error() string
Error implements the Error interface.
func (*StatusError) Status ¶ added in v0.2.1
func (e *StatusError) Status() api.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.2.1
UnexpectedObjectError can be returned by FromObject if it's passed a non-status object.
func (*UnexpectedObjectError) Error ¶ added in v0.2.1
func (u *UnexpectedObjectError) Error() string
Error returns an error message describing 'u'.