error

package
v1.8.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractTerminalReason added in v1.8.0

func ExtractTerminalReason(err error) (string, bool)

ExtractTerminalReason extracts the reason from a terminal error created with NewTerminalError. Returns the reason and true if found, or empty string and false if the error was not created with NewTerminalError.

This allows setStatusProgressing to use specific reasons like "InvalidConfiguration" instead of the generic "Blocked" for all terminal errors.

func NewTerminalError added in v1.8.0

func NewTerminalError(reason string, err error) error

NewTerminalError creates a terminal error with a specific reason. The error is wrapped with reconcile.TerminalError so controller-runtime recognizes it as terminal, while preserving the reason for status reporting.

Example usage:

return error.NewTerminalError(ocv1.ReasonInvalidConfiguration, fmt.Errorf("missing required field"))

The reason can be extracted later using ExtractTerminalReason() when setting status conditions to provide more specific feedback than just "Blocked".

func UnwrapTerminal added in v1.8.0

func UnwrapTerminal(err error) error

UnwrapTerminal unwraps a TerminalError to get the underlying error without the "terminal error:" prefix that reconcile.TerminalError adds to the message. This is useful when displaying error messages in status conditions where the terminal/blocked nature is already conveyed by the condition Reason field.

If err is not a TerminalError, it returns err unchanged. If err is nil, it returns nil.

func WrapTerminal

func WrapTerminal(err error, isTerminal bool) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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