cuerrors

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package cuerrors provides utilities for enhanced error formatting and detailed error reporting when dealing with CUE language errors. It includes functionality to format errors with additional context and details using CUE's built-in error configuration system.

The main component is the Detailer type, which wraps CUE's errors.Config to provide consistent error formatting.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext added in v0.2.3

func NewContext(ctx context.Context, detailer Detailer) context.Context

NewContext returns a new Context, derived from ctx, which carries the provided Detailer.

Types

type Detailer added in v0.2.3

type Detailer struct {
	Cfg errors.Config
}

Detailer struct can be used to format CUE errors with additional details.

func FromContext added in v0.2.3

func FromContext(ctx context.Context) (Detailer, error)

FromContext returns a Detailer from ctx or an error if no Detailer is found.

func FromContextOrDefault added in v0.2.3

func FromContextOrDefault(ctx context.Context) Detailer

FromContextOrDefault returns a Detailer from ctx. If no Detailer is found, this returns a default Detailer.

func NewDetailerWithCwd added in v0.2.3

func NewDetailerWithCwd(cwd string) Detailer

NewDetailerWithCwd creates a new Detailer with the specified current working directory (cwd). In formatted errors, file paths will be made relative to this directory.

func (*Detailer) ErrorWithDetails added in v0.2.3

func (d *Detailer) ErrorWithDetails(err error, format string, args ...any) error

ErrorWithDetails formats an error message with additional details from the provided error.

Jump to

Keyboard shortcuts

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