errors

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AggregateMultiError

func AggregateMultiError(errs []error) error

AggregateMultiError aggregates multiple errors.

func ReportErrors

func ReportErrors(ctx context.Context, log logr.Logger, eventRecorder record.EventRecorder, err error) error

ReportErrors reports all errors of a known internal type as events. unknown errors are logged.

Types

type Error

type Error struct {
	// Src defines the source resource of the error.
	Src runtime.Object
	// Dst defines the destinition resource where the error occurred
	Dst runtime.Object
	// Reason defines a specific error reason
	Reason Reason
	// Msg defines a optional detailed error message
	Msg string
	// Err defines a optional wrapped error
	Err error
}

Error a custom replication error.

func (Error) Error

func (e Error) Error() string

func (Error) Unwrap

func (e Error) Unwrap() error

type ErrorList

type ErrorList []error

ErrorList defines a list of errors

func (ErrorList) AggregateError

func (l ErrorList) AggregateError() error

AggregateError aggregates multiple errors to one error

func (ErrorList) Error

func (l ErrorList) Error() string

type ErrorReporter added in v0.3.0

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

ErrorReporter is a struct that reports aggreagted errors. Is basically a simple wrapper for ReportErrors.

func NewErrorReporter added in v0.3.0

func NewErrorReporter(recorder record.EventRecorder) *ErrorReporter

NewErrorReporter creates a new error reporter

func (ErrorReporter) Report added in v0.3.0

func (er ErrorReporter) Report(ctx context.Context, err error) error

type Reason

type Reason string

Reason defines a specific error reason

const (
	// InternalError defines an internal error in the controller
	InternalError Reason = "InternalError"
	// CreateError defines an error that occurred when a replicated secret could not be created
	CreateError Reason = "CreateError"
	// UpdateError defines an error that occurred when a replicated secret could not be updated
	UpdateError Reason = "UpdateError"
	// InvalidNamespace defines an error reason that is thrown when a namespaces does not exist or cannot be validated
	InvalidNamespace Reason = "InvalidNamespace"
)

Jump to

Keyboard shortcuts

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