errors

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package errors contains useful functionality for conversion errors

Index

Constants

This section is empty.

Variables

View Source
var ErrNilPointer = errors.New("nil pointer")

ErrNilPointer indicates nil pointer, avoid panic. Although unlikely just in case

View Source
var RESTClientGroupResource = schema.GroupResource{Group: "katanomi.dev", Resource: "RESTfulClient"}

RESTClientGroupResource fake GroupResource to use errors api

Functions

func AsAPIError

func AsAPIError(err error) error

AsAPIError returns an error as a apimachinary api error

func AsStatusCode

func AsStatusCode(err error) int

AsStatusCode returns the code from a errors.APIStatus, if not compatible will return InternalServerError

func AsStatusError

func AsStatusError(response *resty.Response, grs ...schema.GroupResource) error

AsStatusError transform resty response to status error

func ConvertKnativeFieldErrorToErrorList

func ConvertKnativeFieldErrorToErrorList(err *apis.FieldError) field.ErrorList

func ConvertKnativeFieldErrorToInternalError

func ConvertKnativeFieldErrorToInternalError(err *apis.FieldError) *field.Error

func ConvertResponseError added in v0.3.0

func ConvertResponseError(ctx context.Context, response *http.Response, err error, gvk schema.GroupVersionKind, names ...string) error

ConvertResponseError converts a gitlab response and an error into a kubernetes api error ctx is the basic context, response is the response object from gitlab sdk, err is the returned error gvk is the GroupVersionKind object with type meta for the object names supports one optional name to be given and will be attributed as the resource name in the returned error

func GVKToGVR added in v0.7.0

GVKToGVR convert schema GroupVersionKind to GroupVersionResource Warning: this function just for show error info

func HandleError

func HandleError(req *restful.Request, resp *restful.Response, err error)

HandleError handles error in requests

func IsTemporaryError

func IsTemporaryError(err error) bool

IsTemporaryError this will check against a list of know non-temporary related errors like 403-Forbidden etc all others will be considered to be temporary

Types

type TemporaryError

type TemporaryError interface {
	error
	Temporary() bool
}

TemporaryError is an error and has a Temporary function

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL