error

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const OperationTimeOutMsg string = "operation has reached the time limit"

Variables

This section is empty.

Functions

func IsNotFoundError

func IsNotFoundError(err error) bool

func IsTemporaryError

func IsTemporaryError(err error) bool

func UnwrapAll

func UnwrapAll(err error) error

UnwrapAll accesses the root cause object of the error. If the error has no cause (leaf error), it is returned directly. this is a replacement for github.com/pkg/errors.Cause

func UnwrapOnce

func UnwrapOnce(err error) (cause error)

UnwrapOnce accesses the direct cause of the error if any, otherwise returns nil.

Types

type ErrComponent

type ErrComponent string
const (
	ErrDB          ErrComponent = "db - keb"
	ErrK8SClient   ErrComponent = "k8s client - keb"
	ErrKEB         ErrComponent = "keb"
	ErrEDP         ErrComponent = "edp"
	ErrProvisioner ErrComponent = "provisioner"
	ErrReconciler  ErrComponent = "reconciler"
	ErrAVS         ErrComponent = "avs"
)

type ErrReason

type ErrReason string
const (
	ErrKEBInternal              ErrReason = "err_keb_internal"
	ErrKEBTimeOut               ErrReason = "err_keb_timeout"
	ErrProvisionerNilLastError  ErrReason = "err_provisioner_nil_last_error"
	ErrHttpStatusCode           ErrReason = "err_http_status_code"
	ErrReconcilerNilFailures    ErrReason = "err_reconciler_nil_failures"
	ErrClusterNotFound          ErrReason = "err_cluster_not_found"
	ErrK8SUnexpectedServerError ErrReason = "err_k8s_unexpected_server_error"
	ErrK8SUnexpectedObjectError ErrReason = "err_k8s_unexpected_object_error"
	ErrK8SNoMatchError          ErrReason = "err_k8s_no_match_error"
	ErrK8SAmbiguousError        ErrReason = "err_k8s_ambiguous_error"
)

type ErrorReporter

type ErrorReporter interface {
	error
	Reason() ErrReason
	Component() ErrComponent
}

type LastError

type LastError struct {
	// contains filtered or unexported fields
}

error reporter

func ReasonForError

func ReasonForError(err error) LastError

resolve error component and reason

func TimeoutError

func TimeoutError(msg string) LastError

func (LastError) Component

func (err LastError) Component() ErrComponent

func (LastError) Error

func (err LastError) Error() string

func (LastError) Reason

func (err LastError) Reason() ErrReason

func (LastError) SetComponent

func (err LastError) SetComponent(component ErrComponent) LastError

func (LastError) SetMessage

func (err LastError) SetMessage(msg string) LastError

func (LastError) SetReason

func (err LastError) SetReason(reason ErrReason) LastError

type NotFoundError

type NotFoundError struct {
}

func (NotFoundError) Component

func (NotFoundError) Component() ErrComponent

func (NotFoundError) Error

func (NotFoundError) Error() string

func (NotFoundError) IsNotFound

func (NotFoundError) IsNotFound() bool

func (NotFoundError) Reason

func (NotFoundError) Reason() ErrReason

type TemporaryError

type TemporaryError struct {
	// contains filtered or unexported fields
}

func AsTemporaryError

func AsTemporaryError(err error, context string, args ...interface{}) *TemporaryError

func NewTemporaryError

func NewTemporaryError(msg string, args ...interface{}) *TemporaryError

func (TemporaryError) Component

func (TemporaryError) Component() ErrComponent

func (TemporaryError) Error

func (te TemporaryError) Error() string

func (TemporaryError) Reason

func (TemporaryError) Reason() ErrReason

func (TemporaryError) Temporary

func (TemporaryError) Temporary() bool

type WrapTemporaryError

type WrapTemporaryError struct {
	// contains filtered or unexported fields
}

can be used for temporary error but still storing the original error in case returned to Execute

func WrapAsTemporaryError

func WrapAsTemporaryError(err error, msg string, args ...interface{}) *WrapTemporaryError

func WrapNewTemporaryError

func WrapNewTemporaryError(err error) *WrapTemporaryError

func (WrapTemporaryError) Component

func (wte WrapTemporaryError) Component() ErrComponent

func (WrapTemporaryError) Error

func (te WrapTemporaryError) Error() string

func (WrapTemporaryError) Reason

func (wte WrapTemporaryError) Reason() ErrReason

func (WrapTemporaryError) Temporary

func (WrapTemporaryError) Temporary() bool

Jump to

Keyboard shortcuts

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