error

package
v0.35.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const EventTypeNone = "None"

EventTypeNone indicates no error event. It can be used to disable error events.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.25.0

type Config struct {
	// Event is the event type of an error. It is used to configure what type of
	// event an error should result in.
	// Valid values:
	//   - EventTypeNone
	//   - corev1.EventTypeNormal
	//   - corev1.EventTypeWarning
	Event string
	// Log is used to configure if an error should be logged. The log level is
	// derived from the Event type.
	// None event - info log
	// Normal event - info log
	// Warning event - error log
	Log bool
	// Notification is used to emit an error as a notification alert to a
	// a notification service.
	Notification bool
	// Ignore is used to suppress the error for no-op reconciliations. It may
	// be applicable to non-contextual errors only.
	Ignore bool
}

Config is the error configuration. It is embedded in the errors and can be used to configure how the error should be handled. These configurations mostly define actions to be taken on the errors. Not all the configurations may apply to every error.

type Event

type Event struct {
	// Reason is the reason for the event error.
	Reason string
	// Error is the actual error for the event.
	Err error
}

Event is an error event. It can be used to construct an event to be recorded. Deprecated: use Generic error with NewGeneric() for the same behavior and replace the RecordContextualError with ErrorActionHandler for result processing.

func (*Event) Error

func (ee *Event) Error() string

Error implements error interface.

func (*Event) Unwrap

func (ee *Event) Unwrap() error

Unwrap returns the underlying error.

type Generic added in v0.25.0

type Generic struct {
	// Reason is the reason for the generic error.
	Reason string
	// Error is the error that caused the generic error.
	Err error
	// Config is the error handler configuration.
	Config
}

Generic error is a generic reconcile error. It can be used in scenarios that don't have any special contextual meaning.

func NewGeneric added in v0.25.0

func NewGeneric(err error, reason string) *Generic

NewGeneric constructs a new Generic error with default configuration.

func (*Generic) Error added in v0.25.0

func (g *Generic) Error() string

Error implements error interface.

func (*Generic) Unwrap added in v0.25.0

func (g *Generic) Unwrap() error

Unwrap returns the underlying error.

type Stalling

type Stalling struct {
	// Reason is the stalled condition reason string.
	Reason string
	// Err is the error that caused stalling. This can be used as the message in
	// stalled condition.
	Err error
	// Config is the error handler configuration.
	Config
}

Stalling is the reconciliation stalled state error. It contains an error and a reason for the stalled condition. It is a contextual error, used to express the scenario which contributed to the reconciliation result.

func NewStalling added in v0.25.0

func NewStalling(err error, reason string) *Stalling

NewStalling constructs a new Stalling error with default configuration.

func (*Stalling) Error

func (se *Stalling) Error() string

Error implements error interface.

func (*Stalling) Unwrap

func (se *Stalling) Unwrap() error

Unwrap returns the underlying error.

type Waiting

type Waiting struct {
	// RequeueAfter is the wait duration after which to requeue.
	RequeueAfter time.Duration
	// Reason is the reason for the wait.
	Reason string
	// Err is the error that caused the wait.
	Err error
	// Config is the error handler configuration.
	Config
}

Waiting is the reconciliation wait state error. It contains an error, wait duration and a reason for the wait. It is a contextual error, used to express the scenario which contributed to the reconciliation result. It is for scenarios where a reconciliation needs to wait for something else to take place first.

func NewWaiting added in v0.25.0

func NewWaiting(err error, reason string) *Waiting

NewWaiting constructs a new Waiting error with default configuration.

func (*Waiting) Error

func (we *Waiting) Error() string

Error implements error interface.

func (*Waiting) Unwrap

func (we *Waiting) Unwrap() error

Unwrap returns the underlying error.

Jump to

Keyboard shortcuts

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