Documentation
¶
Overview ¶
Package errorhandler centralizes Cobra command execution with KSail's error formatting rules.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandError ¶
type CommandError struct {
// contains filtered or unexported fields
}
CommandError represents a Cobra execution failure augmented with normalized stderr output.
func NewCommandError ¶
func NewCommandError(message string, cause error) *CommandError
NewCommandError constructs a CommandError with the provided message and cause.
func (*CommandError) Error ¶
func (e *CommandError) Error() string
Error implements the error interface.
func (*CommandError) Unwrap ¶
func (e *CommandError) Unwrap() error
Unwrap exposes the underlying cause for errors.Is/errors.As consumers.
type DefaultNormalizer ¶
type DefaultNormalizer struct{}
DefaultNormalizer implements Normalizer with the same semantics previously embedded in root.go.
func (DefaultNormalizer) Normalize ¶
func (DefaultNormalizer) Normalize(raw string) string
Normalize trims whitespace, removes redundant "Error:" prefixes, and preserves multi-line usage hints.
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor coordinates Cobra execution, capturing stderr output and surfacing aggregated errors.
func NewExecutor ¶
NewExecutor constructs an Executor with optional functional options.
type Normalizer ¶
Normalizer transforms raw stderr output captured from Cobra into a final error message.
type Option ¶
type Option func(*Executor)
Option configures an Executor.
func WithNormalizer ¶
func WithNormalizer(normalizer Normalizer) Option
WithNormalizer overrides the default message normalizer used by the executor.