errors

package
v0.80.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 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, 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 NewClowderError added in v0.53.0

func NewClowderError(msg string) *ClowderError

NewClowderError 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 []MissingDependency
}

MissingDependencies is a struct that holds a list of MissingDependency structs

func MakeMissingDependencies added in v0.50.0

func MakeMissingDependencies(missingDep MissingDependency) MissingDependencies

func (*MissingDependencies) Error

func (e *MissingDependencies) Error() string

Error returns a string representation of the missing dependencies

type MissingDependency added in v0.50.0

type MissingDependency struct {
	Source  string
	Details string
}

MissingDependency is a struct that holds information about a missing dependency

func (*MissingDependency) ToString added in v0.50.0

func (m *MissingDependency) ToString() string

ToString returns a string representation of the missing dependency

Jump to

Keyboard shortcuts

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