errors

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigSummary

type ConfigSummary struct {
	PackageDir string
	TargetDir  string
	DryRun     bool
	Verbose    int
}

ConfigSummary contains relevant configuration information for error context.

type ErrorContext

type ErrorContext struct {
	Command   string
	Arguments []string
	Config    ConfigSummary
	Timestamp time.Time
}

ErrorContext provides additional information for error rendering.

func Extract

func Extract(cmd *cobra.Command, cfg *ConfigSummary) ErrorContext

Extract pulls context from various sources.

func ExtractCommand

func ExtractCommand(cmd *cobra.Command) ErrorContext

ExtractCommand creates context from just a command.

func ExtractConfig

func ExtractConfig(cfg *ConfigSummary) ErrorContext

ExtractConfig creates context from just config.

type Formatter

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

Formatter converts domain errors to user-friendly messages.

func NewFormatter

func NewFormatter(colorEnabled bool, verbosity int) *Formatter

NewFormatter creates a formatter with the given options.

func (*Formatter) Format

func (f *Formatter) Format(err error) string

Format converts an error to a formatted message.

func (*Formatter) FormatWithContext

func (f *Formatter) FormatWithContext(err error, ctx ErrorContext) string

FormatWithContext adds contextual information to error formatting.

type SuggestionEngine

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

SuggestionEngine generates actionable resolution steps.

func (*SuggestionEngine) Generate

func (e *SuggestionEngine) Generate(err error) []string

Generate creates suggestions for an error.

func (*SuggestionEngine) Prioritize

func (e *SuggestionEngine) Prioritize(suggestions []string) []string

Prioritize orders suggestions by likely usefulness.

type Template

type Template struct {
	Title       string
	Description string
	Details     []string
	Suggestions []string
	Footer      string
}

Template for structured error messages.

func (*Template) Render

func (t *Template) Render(colorEnabled bool, width int) string

Render applies template to produce final message.

Jump to

Keyboard shortcuts

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