apierr

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: Apache-2.0 Imports: 10 Imported by: 38

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsMissing

func IsMissing(err error) bool

IsMissing tells if error is about missing resource

Types

type APIError

type APIError struct {
	ErrorCode  string
	Message    string
	StatusCode int
	Details    []ErrorDetail
}

APIError is a generic struct for an api error on databricks

func GenericIOError added in v0.18.0

func GenericIOError(ue *url.Error) *APIError

func GetAPIError added in v0.18.0

func GetAPIError(ctx context.Context, resp *http.Response, body io.ReadCloser) *APIError

GetAPIError inspects HTTP errors from the Databricks API for known transient errors.

func NotFound

func NotFound(message string) *APIError

NotFound returns properly formatted Not Found error

func ReadError added in v0.18.0

func ReadError(statusCode int, err error) *APIError

func TooManyRequests added in v0.18.0

func TooManyRequests() *APIError

func (*APIError) Error

func (apiError *APIError) Error() string

Error returns error message string instead of

func (*APIError) IsMissing

func (apiError *APIError) IsMissing() bool

IsMissing tells if it is missing resource

func (*APIError) IsRetriable

func (apiError *APIError) IsRetriable(ctx context.Context) bool

isRetriable returns true if error is retriable

func (*APIError) IsTooManyRequests

func (apiError *APIError) IsTooManyRequests() bool

IsTooManyRequests shows rate exceeded limits

type APIErrorBody

type APIErrorBody struct {
	ErrorCode string        `json:"error_code,omitempty"`
	Message   string        `json:"message,omitempty"`
	Details   []ErrorDetail `json:"details,omitempty"`
	// The following two are for scim api only
	// for RFC 7644 Section 3.7.3 https://tools.ietf.org/html/rfc7644#section-3.7.3
	ScimDetail string `json:"detail,omitempty"`
	ScimStatus string `json:"status,omitempty"`
	ScimType   string `json:"scimType,omitempty"`
	API12Error string `json:"error,omitempty"`
}

APIErrorBody maps "proper" databricks rest api errors to a struct

type ErrorDetail added in v0.20.0

type ErrorDetail struct {
	Type     string            `json:"@type,omitempty"`
	Reason   string            `json:"reason,omitempty"`
	Domain   string            `json:"domain,omitempty"`
	Metadata map[string]string `json:"metadata,omitempty"`
}

func GetErrorInfo added in v0.20.0

func GetErrorInfo(err error) []ErrorDetail

GetErrorInfo returns all entries in the list of error details of type `ErrorInfo`.

Jump to

Keyboard shortcuts

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