{"modulePath":"github.com/cnaize/kubernetes","version":"v0.11.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package errors\n\nPackage errors provides detailed error types for api field validation.\n\n## Constants\n\n```go\nconst (\n\tStatusUnprocessableEntity = 422\n\tStatusTooManyRequests     = 429\n\t// HTTP recommendations are for servers to define 5xx error codes\n\t// for scenarios not covered by behavior. In this case, ServerTimeout\n\t// is an indication that a transient server error has occured and the\n\t// client *should* retry, with an optional Retry-After header to specify\n\t// the back off window.\n\tStatusServerTimeout = 504\n)\n```\nHTTP Status codes not in the golang http package.\n\n## Functions\n\n```go\nfunc FromObject(obj runtime.Object) error\n```\nFromObject generates an StatusError from an api.Status, if that is the type of obj; otherwise, returns an UnexpecteObjectError.\n\n```go\nfunc IsAlreadyExists(err error) bool\n```\nIsAlreadyExists determines if the err is an error which indicates that a specified resource already exists.\n\n```go\nfunc IsBadRequest(err error) bool\n```\nIsBadRequest determines if err is an error which indicates that the request is invalid.\n\n```go\nfunc IsConflict(err error) bool\n```\nIsConflict determines if the err is an error which indicates the provided update conflicts.\n\n```go\nfunc IsForbidden(err error) bool\n```\nIsForbidden determines if err is an error which indicates that the request is forbidden and cannot be completed as requested.\n\n```go\nfunc IsInvalid(err error) bool\n```\nIsInvalid determines if the err is an error which indicates the provided resource is not valid.\n\n```go\nfunc IsMethodNotSupported(err error) bool\n```\nIsMethodNotSupported determines if the err is an error which indicates the provided action could not be performed because it is not supported by the server.\n\n```go\nfunc IsNotFound(err error) bool\n```\nIsNotFound returns true if the specified error was created by NewNotFoundErr.\n\n```go\nfunc IsServerTimeout(err error) bool\n```\nIsServerTimeout determines if err is an error which indicates that the request needs to be retried by the client.\n\n```go\nfunc NewAlreadyExists(kind, name string) error\n```\nNewAlreadyExists returns an error indicating the item requested exists by that identifier.\n\n```go\nfunc NewBadRequest(reason string) error\n```\nNewBadRequest creates an error that indicates that the request is invalid and can not be processed.\n\n```go\nfunc NewConflict(kind, name string, err error) error\n```\nNewConflict returns an error indicating the item can't be updated as provided.\n\n```go\nfunc NewForbidden(kind, name string, err error) error\n```\nNewForbidden returns an error indicating the requested action was forbidden\n\n```go\nfunc NewInternalError(err error) error\n```\nNewInternalError returns an error indicating the item is invalid and cannot be processed.\n\n```go\nfunc NewInvalid(kind, name string, errs ValidationErrorList) error\n```\nNewInvalid returns an error indicating the item is invalid and cannot be processed.\n\n```go\nfunc NewMethodNotSupported(kind, action string) error\n```\nNewMethodNotSupported returns an error indicating the requested action is not supported on this kind.\n\n```go\nfunc NewNotFound(kind, name string) error\n```\nNewNotFound returns a new error which indicates that the resource of the kind and the name was not found.\n\n```go\nfunc NewServerTimeout(kind, operation string) error\n```\nNewServerTimeout returns an error indicating the requested action could not be completed due to a transient error, and the client should try again.\n\n```go\nfunc NewTimeoutError(message string) error\n```\nNewTimeoutError returns an error indicating that a timeout occurred before the request could be completed.  Clients may retry, but the operation may still complete.\n\n```go\nfunc NewValidationErrorFieldPrefixMatcher(prefix string) errors.Matcher\n```\nNewValidationErrorFieldPrefixMatcher returns an errors.Matcher that returns true if the provided error is a ValidationError and has a field with the provided prefix.\n\n```go\nfunc NewValidationErrorTypeMatcher(t ValidationErrorType) errors.Matcher\n```\nNewValidationErrorFieldPrefixMatcher returns an errors.Matcher that returns true if the provided error is a ValidationError and has the provided ValidationErrorType.\n\n## Types\n\n```go\ntype StatusError struct {\n\tErrStatus api.Status\n}\n```\nStatusError 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.\n\n```go\nfunc (e *StatusError) Error() string\n```\nError implements the Error interface.\n\n```go\nfunc (e *StatusError) Status() api.Status\n```\nStatus allows access to e's status without having to know the detailed workings of StatusError. Used by pkg/apiserver.\n\n```go\ntype UnexpectedObjectError struct {\n\tObject runtime.Object\n}\n```\nUnexpectedObjectError can be returned by FromObject if it's passed a non-status object.\n\n```go\nfunc (u *UnexpectedObjectError) Error() string\n```\nError returns an error message describing 'u'.\n\n```go\ntype ValidationError struct {\n\tType     ValidationErrorType\n\tField    string\n\tBadValue interface{}\n\tDetail   string\n}\n```\nValidationError is an implementation of the 'error' interface, which represents an error of validation.\n\n```go\nfunc NewFieldDuplicate(field string, value interface{}) *ValidationError\n```\nNewFieldDuplicate returns a \\*ValidationError indicating \"duplicate value\"\n\n```go\nfunc NewFieldForbidden(field string, value interface{}) *ValidationError\n```\nNewFieldForbidden returns a \\*ValidationError indicating \"forbidden\"\n\n```go\nfunc NewFieldInvalid(field string, value interface{}, detail string) *ValidationError\n```\nNewFieldInvalid returns a \\*ValidationError indicating \"invalid value\"\n\n```go\nfunc NewFieldNotFound(field string, value interface{}) *ValidationError\n```\nNewFieldNotFound returns a \\*ValidationError indicating \"value not found\"\n\n```go\nfunc NewFieldNotSupported(field string, value interface{}) *ValidationError\n```\nNewFieldNotSupported returns a \\*ValidationError indicating \"unsupported value\"\n\n```go\nfunc NewFieldRequired(field string, value interface{}) *ValidationError\n```\nNewFieldRequired returns a \\*ValidationError indicating \"value required\" TODO: remove \"value\"\n\n```go\nfunc (v *ValidationError) Error() string\n```\n\n```go\ntype ValidationErrorList []error\n```\n\n```go\nfunc (list ValidationErrorList) Filter(fns ...errors.Matcher) ValidationErrorList\n```\nFilter removes items from the ValidationErrorList that match the provided fns.\n\n```go\nfunc (list ValidationErrorList) Prefix(prefix string) ValidationErrorList\n```\nPrefix adds a prefix to the Field of every ValidationError in the list. Returns the list for convenience.\n\n```go\nfunc (list ValidationErrorList) PrefixIndex(index int) ValidationErrorList\n```\nPrefixIndex adds an index to the Field of every ValidationError in the list. Returns the list for convenience.\n\n```go\ntype ValidationErrorType string\n```\nValidationErrorType is a machine readable value providing more detail about why a field is invalid.  These values are expected to match 1-1 with CauseType in api/types.go.\n\n```go\nconst (\n\t// ValidationErrorTypeNotFound is used to report failure to find a requested value\n\t// (e.g. looking up an ID).\n\tValidationErrorTypeNotFound ValidationErrorType = \"FieldValueNotFound\"\n\t// ValidationErrorTypeRequired is used to report required values that are not\n\t// provided (e.g. empty strings, null values, or empty arrays).\n\tValidationErrorTypeRequired ValidationErrorType = \"FieldValueRequired\"\n\t// ValidationErrorTypeDuplicate is used to report collisions of values that must be\n\t// unique (e.g. unique IDs).\n\tValidationErrorTypeDuplicate ValidationErrorType = \"FieldValueDuplicate\"\n\t// ValidationErrorTypeInvalid is used to report malformed values (e.g. failed regex\n\t// match).\n\tValidationErrorTypeInvalid ValidationErrorType = \"FieldValueInvalid\"\n\t// ValidationErrorTypeNotSupported is used to report valid (as per formatting rules)\n\t// values that can not be handled (e.g. an enumerated string).\n\tValidationErrorTypeNotSupported ValidationErrorType = \"FieldValueNotSupported\"\n\t// ValidationErrorTypeForbidden is used to report valid (as per formatting rules)\n\t// values which would be accepted by some api instances, but which would invoke behavior\n\t// not permitted by this api instance (such as due to stricter security policy).\n\tValidationErrorTypeForbidden ValidationErrorType = \"FieldValueForbidden\"\n)\n```\nTODO: These values are duplicated in api/types.go, but there's a circular dep.  Fix it.\n\n```go\nfunc (t ValidationErrorType) String() string\n```\nString converts a ValidationErrorType into its corresponding error message.\n\n","path":"github.com/cnaize/kubernetes/pkg/api/errors","name":"errors","synopsis":"Package errors provides detailed error types for api field validation.","isRedistributable":true}
