errors

package
v1.0.0-alpha.12 Latest Latest
Warning

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

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

Documentation

Overview

Package errors provides sentinel errors and structured error types for OPM.

Configuration validation errors are CUE-native — see cuelang.org/go/cue/errors for the canonical interface and helpers (Errors, Positions, Print). The library does not wrap CUE diagnostics in custom Go-typed projections, nor does it ship a presentation-layer formatter; frontends walk the CUE error tree and render however their consumer requires.

Index

Constants

View Source
const (
	// MaterializeKindCatalog marks a subscription-resolution failure: a
	// catalog path could not be enumerated, pulled, decoded, or its
	// transformers conflicted. Subscription and Version are populated.
	MaterializeKindCatalog = "catalog"

	// MaterializeKindCoreSchema is reserved for core-schema load failures
	// surfaced through the same shape. Materialize does not yet emit it;
	// when it does, Subscription is empty.
	MaterializeKindCoreSchema = "core-schema"
)

MaterializeError kinds. Kind discriminates where in the Materialize flow a failure originated so frontends can route diagnostics without string matching (D24).

Variables

View Source
var (
	// ErrValidation indicates a CUE schema validation failure.
	ErrValidation = errors.New("validation error")

	// ErrConnectivity indicates a network connectivity issue.
	ErrConnectivity = errors.New("connectivity error")

	// ErrPermission indicates insufficient permissions.
	ErrPermission = errors.New("permission denied")

	// ErrNotFound indicates a resource, module, or file was not found.
	ErrNotFound = errors.New("not found")
)

Sentinel errors for known conditions.

Functions

func Wrap

func Wrap(sentinel error, message string) error

Wrap wraps an error with a sentinel error type.

Types

type MaterializeError

type MaterializeError struct {
	// Kind is one of MaterializeKindCatalog or MaterializeKindCoreSchema.
	Kind string

	// Subscription is the catalog subscription path that failed. Empty when
	// Kind == MaterializeKindCoreSchema.
	Subscription string

	// Version is the resolved or attempted version, when known.
	Version string

	// Cause is the wrapped underlying error.
	Cause error
}

MaterializeError is a structured failure from the platform Materialize flow. It carries a Kind discriminator plus the subscription path and the attempted/resolved version, and wraps the underlying cause so callers can reach it via errors.Unwrap / errors.As.

func (*MaterializeError) Error

func (e *MaterializeError) Error() string

func (*MaterializeError) Unwrap

func (e *MaterializeError) Unwrap() error

type MissingFQN

type MissingFQN struct {
	// Instance is the ModuleInstance name the demanding component belongs to.
	// Was: Release
	Instance string

	// Component is the component name that demanded the FQN.
	Component string

	// FQN is the demanded primitive FQN with no transformer requiring it.
	FQN string

	// Alternatives is the same-modulePath/name FQN set materialized on the
	// platform at other versions, sorted by SemVer. May be empty.
	Alternatives []string
}

MissingFQN is the hard structured diagnostic for a demanded primitive FQN that no transformer on the materialized platform requires (its #matchers bucket is empty). It is distinct from the soft non-match recorded when a transformer is found but its requiredLabels are not satisfied.

One MissingFQN is recorded per (Instance, Component, FQN) triple. Alternatives lists every primitive FQN sharing the same modulePath/name at other SemVers that the platform did materialize, sorted by SemVer — a hint that a different version of the same primitive is available.

func (MissingFQN) Error

func (e MissingFQN) Error() string

type TransformError

type TransformError struct {
	ComponentName  string
	TransformerFQN string
	Cause          error
}

TransformError indicates transformer execution failed.

func (*TransformError) Component

func (e *TransformError) Component() string

Component returns the component name where the error occurred.

func (*TransformError) Error

func (e *TransformError) Error() string

func (*TransformError) Unwrap

func (e *TransformError) Unwrap() error

type UnifyError

type UnifyError struct {
	// Component is the component whose body diverged.
	Component string

	// FQN is the primitive FQN at which the bodies conflicted.
	FQN string

	// Cause is the verbatim CUE error tree, reachable via errors.As for
	// cuelang.org/go/cue/errors.Error.
	Cause error
}

UnifyError is the structured diagnostic for a unification failure between a consumer component's primitive body and a candidate transformer's required primitive body at the same FQN (the always-unify rung).

Cause carries the CUE error tree verbatim — no Go-side reformatting — so a frontend can walk it via [Unwrap] / errors.As for a cuelang.org/go/cue/errors.Error and render the native `conflicting values "X" and "Y": file:line file:line` message.

func (UnifyError) Error

func (e UnifyError) Error() string

func (UnifyError) Unwrap

func (e UnifyError) Unwrap() error

Jump to

Keyboard shortcuts

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