Documentation ¶
Index ¶
- Constants
- func AppendError(err error, nonCriticalErrors []error) ([]error, error)
- func ExtractErrors(err error) ([]error, error)
- func HandleError(err error) (int, error)
- func HandleInternalError(response *restful.Response, err error)
- func IsAlreadyExists(err error) bool
- func IsForbidden(err error) bool
- func IsNotFound(err error) bool
- func IsTokenExpired(err error) bool
- func IsUnauthorized(err error) bool
- func LocalizeError(err error) error
- func MergeErrors(errorArraysToMerge ...[]error) (mergedErrors []error)
- func NewBadRequest(reason string) *k8serrors.StatusError
- func NewCSRFValidationFailed() *k8serrors.StatusError
- func NewForbidden(name string, err error) *k8serrors.StatusError
- func NewGenericResponse(code int, serverMessage string) *k8serrors.StatusError
- func NewInternal(reason string) *k8serrors.StatusError
- func NewInvalid(reason string) *k8serrors.StatusError
- func NewNotFound(reason string) *k8serrors.StatusError
- func NewTokenExpired(reason string) *k8serrors.StatusError
- func NewUnauthorized(reason string) *k8serrors.StatusError
- func NewUnexpectedObject(obj runtime.Object) *k8serrors.StatusError
Constants ¶
const ( MsgDeployNamespaceMismatchError = "MSG_DEPLOY_NAMESPACE_MISMATCH_ERROR" MsgDeployEmptyNamespaceError = "MSG_DEPLOY_EMPTY_NAMESPACE_ERROR" MsgForbiddenError = "MSG_FORBIDDEN_ERROR" MsgDashboardExclusiveResourceError = "MSG_DASHBOARD_EXCLUSIVE_RESOURCE_ERROR" MsgTokenExpiredError = "MSG_TOKEN_EXPIRED_ERROR" MsgCSRFValidationError = "MSG_CSRF_VALIDATION_ERROR" )
Errors that can be used directly without localizing
Variables ¶
This section is empty.
Functions ¶
func AppendError ¶
AppendError handles single error, that occurred during API GET call. If it is not critical, then it will be returned as a part of error array. Otherwise, it will be returned as a second value. Usage of this functions allows to distinguish critical errors from non-critical ones. It is needed to handle them in a different way.
func ExtractErrors ¶
ExtractErrors handles single error, that occurred during API GET call. If it is not critical, then it will be returned as a part of error array. Otherwise, it will be returned as a second value. Usage of this function allows to distinguish critical errors from non-critical ones. It is needed to handle them in a different way.
func HandleError ¶
func HandleInternalError ¶
func HandleInternalError(response *restful.Response, err error)
HandleInternalError writes the given error to the response and sets appropriate HTTP status headers.
func IsAlreadyExists ¶
IsAlreadyExists determines if a specified resource already exists.
func IsForbidden ¶
IsForbidden determines if request has been forbidden and requires extra privileges for the user.
func IsNotFound ¶
func IsTokenExpired ¶
IsTokenExpired determines if the error is an error which errStatus message is MsgTokenExpiredError
func IsUnauthorized ¶
IsUnauthorized determines if request is unauthorized and requires authentication by the user.
func LocalizeError ¶
LocalizeError returns error code (string) that can be used by frontend to localize error message.
func MergeErrors ¶
MergeErrors merges multiple non-critical error arrays into one array.
func NewBadRequest ¶
func NewBadRequest(reason string) *k8serrors.StatusError
NewBadRequest creates an error that indicates that the request is invalid and can not be processed.
func NewCSRFValidationFailed ¶
func NewCSRFValidationFailed() *k8serrors.StatusError
func NewForbidden ¶
func NewForbidden(name string, err error) *k8serrors.StatusError
func NewGenericResponse ¶
func NewGenericResponse(code int, serverMessage string) *k8serrors.StatusError
NewGenericResponse return a statusError which 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 by switch the error code.
func NewInternal ¶
func NewInternal(reason string) *k8serrors.StatusError
NewInternal return a statusError which 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 NewInvalid ¶
func NewInvalid(reason string) *k8serrors.StatusError
NewInvalid return a statusError which 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 NewNotFound ¶
func NewNotFound(reason string) *k8serrors.StatusError
NewNotFound return a statusError which 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 NewTokenExpired ¶
func NewTokenExpired(reason string) *k8serrors.StatusError
NewTokenExpired return a statusError which 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 NewUnauthorized ¶
func NewUnauthorized(reason string) *k8serrors.StatusError
NewUnauthorized returns an error indicating the client is not authorized to perform the requested action.
func NewUnexpectedObject ¶
func NewUnexpectedObject(obj runtime.Object) *k8serrors.StatusError
NewUnexpectedObject return a statusError which 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.
Types ¶
This section is empty.