{"modulePath":"github.com/AlaudaDevops/pkg","version":"v0.14.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package errors\n\nPackage errors provides a set of error functions\n\n## Variables\n\n```go\nvar ErrNilPointer = errors.New(\"nil pointer\")\n```\nErrNilPointer indicates nil pointer, avoid panic. Although unlikely just in case\n\n```go\nvar RESTAPIGroupResource = schema.GroupResource{Group: \"alauda.io\", Resource: \"API\"}\n```\nRESTAPIGroupResource fake GroupResource to use errors api\n\n```go\nvar RESTClientGroupResource = schema.GroupResource{Group: \"alauda.io\", Resource: \"RESTfulClient\"}\n```\nRESTClientGroupResource fake GroupResource to use errors api\n\n## Functions\n\n```go\nfunc AsAPIError(err error) error\n```\nAsAPIError returns an error as a apimachinary api error\n\n```go\nfunc AsStatusCode(err error) int\n```\nAsStatusCode returns the code from a errors.APIStatus, if not compatible will return InternalServerError\n\n```go\nfunc AsStatusError(response *resty.Response, grs ...schema.GroupResource) error\n```\nAsStatusError transform resty response to status error\n\n```go\nfunc HandleError(req *restful.Request, resp *restful.Response, err error)\n```\nHandleError handles error in requests\n\n```go\nfunc IsTemporaryError(err error) bool\n```\nIsTemporaryError this will check against a list of know non-temporary related errors like 403-Forbidden etc all others will be considered to be temporary\n\n## Types\n\n```go\ntype TemporaryError interface {\n\terror\n\tTemporary() bool\n}\n```\nTemporaryError is an error and has a Temporary function\n\n","path":"github.com/AlaudaDevops/pkg/errors","name":"errors","synopsis":"Package errors provides a set of error functions","isRedistributable":true}
