errors

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package errors provides typed reconcile error classes (ADR-0602).

Index

Constants

View Source
const (
	ClassTransient = "transient"
	ClassTerminal  = "terminal"
	ClassForbidden = "forbidden"
)

Reconcile error classes — align with metrics label values in internal/metrics.

Variables

View Source
var (
	ErrTransient = errors.New("transient")
	ErrTerminal  = errors.New("terminal")
	ErrForbidden = errors.New("forbidden")
)

Sentinel values for errors.Is classification.

Functions

func ClassOf

func ClassOf(err error) string

ClassOf returns the metrics error_class for err (defaults to transient).

func ClassifyAPI

func ClassifyAPI(err error) error

ClassifyAPI maps common Kubernetes API errors to typed classes.

func Forbidden

func Forbidden(err error) error

Forbidden marks RBAC/SAR denial (partial degradation).

func Format

func Format(class error, format string, args ...any) error

Format wraps a message around an already-classified error.

func IsForbidden

func IsForbidden(err error) bool

IsForbidden reports whether err is an RBAC/SAR denial.

func IsTerminal

func IsTerminal(err error) bool

IsTerminal reports whether err should stop requeue until spec changes.

func IsTransient

func IsTransient(err error) bool

IsTransient reports whether err should be retried with backoff.

func Terminal

func Terminal(err error) error

Terminal marks err as non-retryable until spec changes (bad config, missing refs).

func Transient

func Transient(err error) error

Transient marks err as retryable (network, throttling, transient sink failure).

Types

type ClassError

type ClassError struct {
	Class error
	Err   error
}

ClassError wraps an underlying error with a reconcile class.

func (*ClassError) Error

func (e *ClassError) Error() string

func (*ClassError) Is

func (e *ClassError) Is(target error) bool

func (*ClassError) Unwrap

func (e *ClassError) Unwrap() error

Jump to

Keyboard shortcuts

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