errors

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a resource is not found
	ErrNotFound = errors.New("not found")

	// ErrAlreadyExists is returned when a resource already exists
	ErrAlreadyExists = errors.New("already exists")

	// ErrInvalidInput is returned when input validation fails
	ErrInvalidInput = errors.New("invalid input")

	// ErrUnauthorized is returned when authentication fails
	ErrUnauthorized = errors.New("unauthorized")

	// ErrForbidden is returned when access is denied
	ErrForbidden = errors.New("forbidden")

	// ErrTimeout is returned when an operation times out
	ErrTimeout = errors.New("timeout")

	// ErrCancelled is returned when an operation is cancelled
	ErrCancelled = errors.New("cancelled")

	// ErrProviderNotFound is returned when an LLM provider is not found
	ErrProviderNotFound = errors.New("provider not found")

	// ErrProviderNotInitialized is returned when a provider is not initialized
	ErrProviderNotInitialized = errors.New("provider not initialized")

	// ErrModelNotSupported is returned when a model is not supported
	ErrModelNotSupported = errors.New("model not supported")

	// ErrRateLimited is returned when rate limited by API
	ErrRateLimited = errors.New("rate limited")

	// ErrInsufficientCredits is returned when out of API credits
	ErrInsufficientCredits = errors.New("insufficient credits")

	// ErrAPIError is returned for generic API errors
	ErrAPIError = errors.New("API error")

	// ErrNoAgentFound is returned when no suitable agent is found
	ErrNoAgentFound = errors.New("no suitable agent found")

	// ErrTaskFailed is returned when a task execution fails
	ErrTaskFailed = errors.New("task failed")

	// ErrDependencyNotMet is returned when task dependencies are not met
	ErrDependencyNotMet = errors.New("dependency not met")

	// ErrSessionNotFound is returned when a session is not found
	ErrSessionNotFound = errors.New("session not found")

	// ErrDatabaseError is returned for database errors
	ErrDatabaseError = errors.New("database error")

	// ErrConfigError is returned for configuration errors
	ErrConfigError = errors.New("configuration error")
)

Sentinel errors

Functions

func As

func As(err error, target interface{}) bool

As finds the first error in err's tree that matches target

func Is

func Is(err, target error) bool

Is checks if err matches target

func Wrap

func Wrap(op string, kind error, err error) error

Wrap wraps an error with operation and kind

Types

type LumecodeError

type LumecodeError struct {
	Op      string                 // Operation that failed
	Kind    error                  // Category of error
	Err     error                  // Underlying error
	Context map[string]interface{} // Additional context
}

LumecodeError is a structured error with additional context

func AgentError

func AgentError(agent string, taskID string, err error) *LumecodeError

AgentError creates an agent-related error

func ConfigError

func ConfigError(field string, err error) *LumecodeError

ConfigError creates a configuration-related error

func DatabaseError

func DatabaseError(op string, err error) *LumecodeError

DatabaseError creates a database-related error

func New

func New(op string, kind error, err error) *LumecodeError

New creates a new LumecodeError

func ProviderError

func ProviderError(provider string, err error) *LumecodeError

ProviderError creates a provider-related error

func ValidationError

func ValidationError(field string, reason string) *LumecodeError

ValidationError creates a validation error

func (*LumecodeError) Error

func (e *LumecodeError) Error() string

Error implements the error interface

func (*LumecodeError) Is

func (e *LumecodeError) Is(target error) bool

Is checks if the error matches the target

func (*LumecodeError) Unwrap

func (e *LumecodeError) Unwrap() error

Unwrap returns the underlying error

func (*LumecodeError) WithContext

func (e *LumecodeError) WithContext(key string, value interface{}) *LumecodeError

WithContext adds context to the error

Jump to

Keyboard shortcuts

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