error

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 5 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 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 SanitizedError added in v1.2.5

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

func SanitizeError added in v1.2.5

func SanitizeError(err error) SanitizedError

SanitizeError extracts all URLs from the error message and replaces them with the URL without the query string.

func (SanitizedError) Error added in v1.2.5

func (e SanitizedError) Error() string

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