Documentation ¶
Index ¶
- func CollectErrorCodes(err error) []lsv1alpha1.ErrorCode
- func ContainsAnyErrorCode(codes []lsv1alpha1.ErrorCode, expected []lsv1alpha1.ErrorCode) bool
- func ContainsErrorCode(err error, code lsv1alpha1.ErrorCode) bool
- func HasErrorCode(codes []lsv1alpha1.ErrorCode, expected lsv1alpha1.ErrorCode) bool
- func TryUpdateError(lastErr *lsv1alpha1.Error, err error) *lsv1alpha1.Error
- func TryUpdateLsError(lastErr *lsv1alpha1.Error, err LsError) *lsv1alpha1.Error
- func UpdatedError(lastError *lsv1alpha1.Error, operation, reason, message string, ...) *lsv1alpha1.Error
- type Error
- type LsError
- func BuildLsError(err error, operation, reason, message string, codes ...lsv1alpha1.ErrorCode) LsError
- func BuildLsErrorOrNil(err error, operation, reason string, codes ...lsv1alpha1.ErrorCode) LsError
- func NewErrorOrNil(err error, operation, reason string, codes ...lsv1alpha1.ErrorCode) LsError
- func NewWrappedError(err error, operation, reason, message string, codes ...lsv1alpha1.ErrorCode) LsError
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 ¶
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) LandscaperError ¶
func (e Error) LandscaperError() *lsv1alpha1.Error
LandscaperError returns the wrapped landscaper error.
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