alkasir: github.com/alkasir/alkasir/pkg/shared/apierrors Index | Files

package apierrors

import "github.com/alkasir/alkasir/pkg/shared/apierrors"

Package errors provides detailed error types for api field validation.

Index

Package Files

doc.go errors.go

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.

func FromObject Uses

func FromObject(obj interface{}) error

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

func IsAlreadyExists Uses

func IsAlreadyExists(err error) bool

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

func IsBadRequest Uses

func IsBadRequest(err error) bool

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

func IsConflict Uses

func IsConflict(err error) bool

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

func IsForbidden Uses

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 Uses

func IsInvalid(err error) bool

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

func IsMethodNotSupported Uses

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 Uses

func IsNotFound(err error) bool

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

func IsServerTimeout Uses

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 Uses

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 Uses

func IsUnexpectedObjectError(err error) bool

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

func IsUnexpectedServerError Uses

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 Uses

func NewAlreadyExists(kind, name string) error

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

func NewBadRequest Uses

func NewBadRequest(reason string) error

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

func NewConflict Uses

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

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

func NewForbidden Uses

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

NewForbidden returns an error indicating the requested action was forbidden

func NewGenericServerResponse Uses

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 Uses

func NewInternalError(err error) error

NewInternalError returns an error indicating the item is invalid and cannot be processed.

func NewInvalid Uses

func NewInvalid(kind, name string, errs fielderrors.ValidationErrorList) error

NewInvalid returns an error indicating the item is invalid and cannot be processed.

func NewMethodNotSupported Uses

func NewMethodNotSupported(kind, action string) error

NewMethodNotSupported returns an error indicating the requested action is not supported on this kind.

func NewNotFound Uses

func NewNotFound(kind, name string) error

NewNotFound returns a new error which indicates that the resource of the kind and the name was not found.

func NewServerTimeout Uses

func NewServerTimeout(kind, operation string, retryAfterSeconds int) error

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 Uses

func NewTimeoutError(message string, retryAfterSeconds int) error

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 Uses

func NewUnauthorized(reason string) error

NewUnauthorized returns an error indicating the client is not authorized to perform the requested action.

func SuggestsClientDelay Uses

func SuggestsClientDelay(err error) (int, bool)

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.

type StatusError Uses

type StatusError struct {
    ErrStatus api.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 (*StatusError) DebugError Uses

func (e *StatusError) DebugError() (string, []interface{})

DebugError reports extended info about the error to debug output.

func (*StatusError) Error Uses

func (e *StatusError) Error() string

Error implements the Error interface.

func (*StatusError) Status Uses

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 Uses

type UnexpectedObjectError struct {
    Object interface{}
}

UnexpectedObjectError can be returned by FromObject if it's passed a non-status object.

func (*UnexpectedObjectError) Error Uses

func (u *UnexpectedObjectError) Error() string

Error returns an error message describing 'u'.

Package apierrors imports 7 packages (graph) and is imported by 5 packages. Updated 2016-07-24. Refresh now. Tools for package owners.