errors

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRootStack

func GetRootStack(err error) string

GetRootStack will recurse through an error until it finds one with a stack string set.

func HandleError

func HandleError(ctx context.Context, err error) bool

HandleError handles certain ClowdError types differently than normal errors.

func LogError

func LogError(ctx context.Context, name string, err *ClowderError)

LogError logs an error using the given contexts logger and a string.

func RootCause

func RootCause(err error) error

RootCause takes an error an unwraps it, if it is nil, it calls RootCause on the returned err, this will recursively find an error that has an unwrapped value.

Types

type ClowdKey

type ClowdKey string

ClowdKey is a string determining the type of error.

type ClowderError

type ClowderError struct {
	Stack   zap.Field
	Msg     string
	Cause   error
	Requeue bool
}

ClowderError is a Clowder specific error, it has a number of functions attached to it to allow for creation and checking.

func New

func New(msg string) *ClowderError

New constructs a new ClowderError object.

func Wrap

func Wrap(msg string, err error) *ClowderError

Wrap takes an existing error an wraps it, returning a ClowderError

func (*ClowderError) Error

func (a *ClowderError) Error() string

func (*ClowderError) Is

func (a *ClowderError) Is(target error) bool

Is checks that a target is the same as a given error, that is, it has the same message and cause.

func (*ClowderError) Unwrap

func (a *ClowderError) Unwrap() error

type MissingDependencies

type MissingDependencies struct {
	MissingDeps map[string][]string
}

MissingDependencies is a struct containing a map of string lists, it is intended to hold information about missing dependencies. The key is a resource type, or a provider as a string, and the list is a list of keys or items that are missing.

func (*MissingDependencies) Error

func (e *MissingDependencies) Error() string

Jump to

Keyboard shortcuts

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