errors

package
v2.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ErrCodeInvalidInput     = "INVALID_INPUT"
	ErrCodeNotFound         = "NOT_FOUND"
	ErrCodeExecutionFailed  = "EXECUTION_FAILED"
	ErrCodeTimeout          = "TIMEOUT"
	ErrCodeCancelled        = "CANCELLED"
	ErrCodeValidationFailed = "VALIDATION_FAILED"
	ErrCodeInternal         = "INTERNAL_ERROR"
	ErrCodePermissionDenied = "PERMISSION_DENIED"
)

Machine-readable error codes for structured error responses across the CLI and MCP surfaces.

Variables

View Source
var ExitFunc = os.Exit

ExitFunc is invoked by the CLI error handler to terminate the process after a structured envelope has been written. It is overridable so tests can observe the exit code (and message) without actually exiting.

Functions

This section is empty.

Types

type CacheUpdateError

type CacheUpdateError struct {
	Err error
}

func NewCacheUpdateError

func NewCacheUpdateError(err error) CacheUpdateError

func (CacheUpdateError) Code

func (e CacheUpdateError) Code() string

func (CacheUpdateError) Error

func (e CacheUpdateError) Error() string

func (CacheUpdateError) Unwrap

func (e CacheUpdateError) Unwrap() error

type Coder

type Coder interface {
	error
	Code() string
}

Coder is implemented by errors that carry a machine-readable error code.

type Detail

type Detail struct {
	Code    string         `json:"code"              yaml:"code"`
	Message string         `json:"message"           yaml:"message"`
	Details map[string]any `json:"details,omitempty" yaml:"details,omitempty"`
}

Detail is the structured error body inside an Envelope.

type Envelope

type Envelope struct {
	Error Detail `json:"error" yaml:"error"`
}

Envelope is the top-level JSON/YAML payload for structured error responses.

func NewEnvelope

func NewEnvelope(code, message string, details map[string]any) Envelope

NewEnvelope builds an Envelope from the given code, message, and optional details.

func ParseEnvelope

func ParseEnvelope(data []byte) (Envelope, error)

ParseEnvelope attempts to decode data as a JSON or YAML error envelope. It returns the parsed Envelope and a nil error on success. If data does not contain a valid envelope (or has an empty error code), it returns a non-nil error — callers can use this to distinguish structured errors from plain text.

type ExecutableContextError

type ExecutableContextError struct {
	Workspace, Namespace, WorkspacePath, FlowFile string
}

func (ExecutableContextError) Code

func (e ExecutableContextError) Code() string

func (ExecutableContextError) Error

func (e ExecutableContextError) Error() string

type ExecutableNotFoundError

type ExecutableNotFoundError struct {
	Ref string
}

func NewExecutableNotFoundError

func NewExecutableNotFoundError(ref string) ExecutableNotFoundError

func (ExecutableNotFoundError) Code

func (ExecutableNotFoundError) Error

func (e ExecutableNotFoundError) Error() string

type UsageError

type UsageError struct {
	Msg string
}

UsageError indicates the user supplied invalid flags/arguments or attempted an unsupported combination.

func NewUsageError

func NewUsageError(format string, args ...any) UsageError

func (UsageError) Code

func (e UsageError) Code() string

func (UsageError) Error

func (e UsageError) Error() string

type ValidationError

type ValidationError struct {
	Msg     string
	Details map[string]any
}

ValidationError indicates a value failed semantic or schema validation.

func NewValidationError

func NewValidationError(msg string, details map[string]any) ValidationError

func (ValidationError) Code

func (e ValidationError) Code() string

func (ValidationError) Error

func (e ValidationError) Error() string

type WorkspaceNotFoundError

type WorkspaceNotFoundError struct {
	Workspace string
}

func (WorkspaceNotFoundError) Code

func (e WorkspaceNotFoundError) Code() string

func (WorkspaceNotFoundError) Error

func (e WorkspaceNotFoundError) Error() string

Jump to

Keyboard shortcuts

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