errors

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package errors provides a set of error functions

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 RESTAPIGroupResource = schema.GroupResource{Group: "alauda.io", Resource: "API"}

RESTAPIGroupResource fake GroupResource to use errors api

View Source
var RESTClientGroupResource = schema.GroupResource{Group: "alauda.io", 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 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