errors

package
v0.121.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectErrorCodes

func CollectErrorCodes(err error) []lsv1alpha1.ErrorCode

func ContainsAnyErrorCode

func ContainsAnyErrorCode(codes []lsv1alpha1.ErrorCode, expected []lsv1alpha1.ErrorCode) bool

ContainsAnyErrorCode checks whether any expected error code is included in a list of error codes

func ContainsErrorCode

func ContainsErrorCode(err error, code lsv1alpha1.ErrorCode) bool

func HasErrorCode

func HasErrorCode(codes []lsv1alpha1.ErrorCode, expected lsv1alpha1.ErrorCode) bool

HasErrorCode checks if a code is present in the a list of error codes.

func TryUpdateError

func TryUpdateError(lastErr *lsv1alpha1.Error, err error) *lsv1alpha1.Error

TryUpdateError tries to update the properties of the last error if the err is a internal landscaper error.

func TryUpdateLsError

func TryUpdateLsError(lastErr *lsv1alpha1.Error, err LsError) *lsv1alpha1.Error

TryUpdateLsError tries to update the properties of the last error if the err is a internal landscaper error.

func UpdatedError

func UpdatedError(lastError *lsv1alpha1.Error, operation, reason, message string, codes ...lsv1alpha1.ErrorCode) *lsv1alpha1.Error

UpdatedError updates the properties of a error.

Types

type Error

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

Error is a wrapper around the landscaper crd error that implements the go error interface.

func IsError

func IsError(err error) (*Error, bool)

IsError returns the landscaper error if the given error is one. If the err does not contain a landscaper error nil is returned.

func NewError

func NewError(operation, reason, message string, codes ...lsv1alpha1.ErrorCode) *Error

NewError creates a new landscaper internal error

func (Error) Error

func (e Error) Error() string

Error implements the error interface

func (Error) LandscaperError

func (e Error) LandscaperError() *lsv1alpha1.Error

LandscaperError returns the wrapped landscaper error.

func (Error) Unwrap

func (e Error) Unwrap() error

Unwrap implements the unwrap interface

func (Error) UpdatedError

func (e Error) UpdatedError(lastError *lsv1alpha1.Error) *lsv1alpha1.Error

UpdatedError updates the properties of an existing error.

type LsError

type LsError interface {
	error
	LandscaperError() *lsv1alpha1.Error
	Unwrap() error
	UpdatedError(lastError *lsv1alpha1.Error) *lsv1alpha1.Error
}

func BuildLsError

func BuildLsError(err error, operation, reason, message string, codes ...lsv1alpha1.ErrorCode) LsError

BuildLsError creates a new landscaper internal error if the provided error is not already of such a type or nil. Otherwise the error is returned.

func BuildLsErrorOrNil

func BuildLsErrorOrNil(err error, operation, reason string, codes ...lsv1alpha1.ErrorCode) LsError

BuildLsErrorOrNil creates a new landscaper internal error if the provided error is not already of such a type or nil. Otherwise the error is returned. If the input error is nil also nil is returned.

func NewErrorOrNil

func NewErrorOrNil(err error, operation, reason string, codes ...lsv1alpha1.ErrorCode) LsError

NewErrorOrNil creates a new landscaper internal error that wraps another error. if no error is set the functions return nil. The error is automatically set as error message.

func NewWrappedError

func NewWrappedError(err error, operation, reason, message string, codes ...lsv1alpha1.ErrorCode) LsError

NewWrappedError creates a new landscaper internal error that wraps another error

Jump to

Keyboard shortcuts

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