errors

package
v0.16.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2015 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package errors provides detailed error types for api field validation.

Index

Constants

View Source
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

func FromObject(obj runtime.Object) error

FromObject generates an StatusError from an api.Status, if that is the type of obj; otherwise, returns an UnexpecteObjectError.

func IsAlreadyExists

func IsAlreadyExists(err error) bool

IsAlreadyExists determines if the err is an error which indicates that a specified resource already exists.

func IsBadRequest added in v0.5.1

func IsBadRequest(err error) bool

IsBadRequest determines if err is an error which indicates that the request is invalid.

func IsConflict

func IsConflict(err error) bool

IsConflict determines if the err is an error which indicates the provided update conflicts.

func IsForbidden added in v0.10.0

func IsForbidden(err error) bool

IsForbidden determines if err is an error which indicates that the request is forbidden and cannot be completed as requested.

func IsInvalid

func IsInvalid(err error) bool

IsInvalid determines if the err is an error which indicates the provided resource is not valid.

func IsMethodNotSupported added in v0.9.0

func IsMethodNotSupported(err error) bool

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

func IsNotFound(err error) bool

IsNotFound returns true if the specified error was created by NewNotFoundErr.

func IsServerTimeout added in v0.11.0

func IsServerTimeout(err error) bool

IsServerTimeout determines if err is an error which indicates that the request needs to be retried by the client.

func IsUnauthorized added in v0.14.0

func IsUnauthorized(err error) bool

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

func IsUnexpectedObjectError(err error) bool

IsUnexpectedObjectError determines if err is due to an unexpected object from the master.

func IsUnexpectedServerError added in v0.15.0

func IsUnexpectedServerError(err error) bool

IsUnexpectedServerError returns true if the server response was not in the expected API format, and may be the result of another HTTP actor.

func NewAlreadyExists

func NewAlreadyExists(kind, name string) error

NewAlreadyExists returns an error indicating the item requested exists by that identifier.

func NewBadRequest added in v0.5.1

func NewBadRequest(reason string) error

NewBadRequest creates an error that indicates that the request is invalid and can not be processed.

func NewConflict

func NewConflict(kind, name string, err error) error

NewConflict returns an error indicating the item can't be updated as provided.

func NewForbidden added in v0.9.0

func NewForbidden(kind, name string, err error) error

NewForbidden returns an error indicating the requested action was forbidden

func NewGenericServerResponse added in v0.15.0

func NewGenericServerResponse(code int, verb, kind, name, serverMessage string, retryAfterSeconds int, isUnexpectedResponse bool) error

NewGenericServerResponse returns a new error for server responses that are not in a recognizable form.

func NewInternalError added in v0.5.1

func NewInternalError(err error)