errors

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAuthError

func IsAuthError(err error) bool

IsAuthError checks if the error is an authentication error

func IsNotFound

func IsNotFound(err error) bool

IsNotFound checks if the error is a not found error

func IsRateLimitError

func IsRateLimitError(err error) bool

IsRateLimitError checks if the error is a rate limit error

func IsTimeout

func IsTimeout(err error) bool

IsTimeout checks if the error is a timeout error

Types

type AppError

type AppError struct {
	Code    ErrorCode
	Message string
	Err     error
}

AppError represents an application error with code

func Errorf

func Errorf(code ErrorCode, format string, args ...interface{}) *AppError

Errorf creates a new AppError with formatted message. This is a drop-in replacement for fmt.Errorf that uses AppError format. Usage: errors.Errorf(errors.ErrCodeInvalidInput, "invalid value: %s", value)

func NewAgentInitError

func NewAgentInitError(err error) *AppError

NewAgentInitError creates an agent initialization error

func NewAgentProcessError

func NewAgentProcessError(err error) *AppError

NewAgentProcessError creates an agent process error

func NewAppError

func NewAppError(code ErrorCode, message string) *AppError

NewAppError creates a new AppError

func NewConfigInvalidError

func NewConfigInvalidError(err error, field string) *AppError

NewConfigInvalidError creates a config invalid error

func NewConfigNotFoundError

func NewConfigNotFoundError(path string) *AppError

NewConfigNotFoundError creates a config not found error

func NewGatewayConnectError

func NewGatewayConnectError(err error, platform string) *AppError

NewGatewayConnectError creates a gateway connect error

func NewGatewayDisconnectError

func NewGatewayDisconnectError(err error, platform string) *AppError

NewGatewayDisconnectError creates a gateway disconnect error

func NewGatewayInitError

func NewGatewayInitError(err error) *AppError

NewGatewayInitError creates a gateway init error

func NewGatewayMessageError

func NewGatewayMessageError(err error) *AppError

NewGatewayMessageError creates a gateway message error

func NewInternalError

func NewInternalError(err error) *AppError

NewInternalError creates an internal error

func NewInvalidInputError

func NewInvalidInputError(msg string) *AppError

NewInvalidInputError creates an invalid input error

func NewPermissionDeniedError

func NewPermissionDeniedError() *AppError

NewPermissionDeniedError creates a permission denied error

func NewProviderAuthError

func NewProviderAuthError() *AppError

NewProviderAuthError creates a provider auth error

func NewProviderCallError

func NewProviderCallError(err error) *AppError

NewProviderCallError creates a provider call error

func NewProviderNotFoundError

func NewProviderNotFoundError(name string) *AppError

NewProviderNotFoundError creates a provider not found error

func NewProviderRateLimitError

func NewProviderRateLimitError(provider string) *AppError

NewProviderRateLimitError creates a provider rate limit error

func NewSessionCreateError

func NewSessionCreateError(err error) *AppError

NewSessionCreateError creates a session create error

func NewSessionExpiredError

func NewSessionExpiredError(id string) *AppError

NewSessionExpiredError creates a session expired error

func NewSessionNotFoundError

func NewSessionNotFoundError(id string) *AppError

NewSessionNotFoundError creates a session not found error

func NewSkillExecutionError

func NewSkillExecutionError(err error, name string) *AppError

NewSkillExecutionError creates a skill execution error

func NewSkillLoadError

func NewSkillLoadError(err error, name string) *AppError

NewSkillLoadError creates a skill load error

func NewSkillNotFoundError

func NewSkillNotFoundError(name string) *AppError

NewSkillNotFoundError creates a skill not found error

func NewToolExecutionError

func NewToolExecutionError(err error) *AppError

NewToolExecutionError creates a tool execution error

func NewToolInvalidParamsError

func NewToolInvalidParamsError(name string) *AppError

NewToolInvalidParamsError creates a tool invalid parameters error

func NewToolNotFoundError

func NewToolNotFoundError(name string) *AppError

NewToolNotFoundError creates a tool not found error

func NewToolTimeoutError

func NewToolTimeoutError(name string) *AppError

NewToolTimeoutError creates a tool timeout error

func NewUnauthorizedError

func NewUnauthorizedError() *AppError

NewUnauthorizedError creates an unauthorized error

func WithMessage

func WithMessage(code ErrorCode, message string) *AppError

WithMessage creates an AppError with just a message, using ErrCodeInternalError.

func Wrap

func Wrap(err error, code ErrorCode, message string) *AppError

Wrap wraps an error with code and message

func WrapError

func WrapError(err error, code ErrorCode, format string, args ...interface{}) *AppError

WrapError wraps an existing error with a formatted message. Usage: errors.WrapError(err, errors.ErrCodeInvalidInput, "validation failed: %s", detail)

func (*AppError) Error

func (e *AppError) Error() string

Error implements the error interface

func (*AppError) Unwrap

func (e *AppError) Unwrap() error

Unwrap returns the wrapped error

type ErrorCode

type ErrorCode string

ErrorCode represents an error code

const (
	// General errors
	ErrCodeUnknown          ErrorCode = "UNKNOWN"
	ErrCodeInvalidInput     ErrorCode = "INVALID_INPUT"
	ErrCodeInternalError    ErrorCode = "INTERNAL_ERROR"
	ErrCodeNotFound         ErrorCode = "NOT_FOUND"
	ErrCodeTimeout          ErrorCode = "TIMEOUT"
	ErrCodeUnauthorized     ErrorCode = "UNAUTHORIZED"
	ErrCodePermissionDenied ErrorCode = "PERMISSION_DENIED"

	// Agent errors
	ErrCodeAgentInit    ErrorCode = "AGENT_INIT_FAILED"
	ErrCodeAgentProcess ErrorCode = "AGENT_PROCESS_FAILED"
	ErrCodeAgentTimeout ErrorCode = "AGENT_TIMEOUT"

	// Tool errors
	ErrCodeToolNotFound      ErrorCode = "TOOL_NOT_FOUND"
	ErrCodeToolExecution     ErrorCode = "TOOL_EXECUTION_FAILED"
	ErrCodeToolTimeout       ErrorCode = "TOOL_TIMEOUT"
	ErrCodeToolInvalidParams ErrorCode = "TOOL_INVALID_PARAMS"

	// Provider errors
	ErrCodeProviderInit      ErrorCode = "PROVIDER_INIT_FAILED"
	ErrCodeProviderCall      ErrorCode = "PROVIDER_CALL_FAILED"
	ErrCodeProviderAuth      ErrorCode = "PROVIDER_AUTH_FAILED"
	ErrCodeProviderRateLimit ErrorCode = "PROVIDER_RATE_LIMIT"
	ErrCodeProviderNotFound  ErrorCode = "PROVIDER_NOT_FOUND"

	// Gateway errors
	ErrCodeGatewayInit       ErrorCode = "GATEWAY_INIT_FAILED"
	ErrCodeGatewayConnect    ErrorCode = "GATEWAY_CONNECT_FAILED"
	ErrCodeGatewayDisconnect ErrorCode = "GATEWAY_DISCONNECT_FAILED"
	ErrCodeGatewayMessage    ErrorCode = "GATEWAY_MESSAGE_FAILED"

	// Session errors
	ErrCodeSessionNotFound ErrorCode = "SESSION_NOT_FOUND"
	ErrCodeSessionCreate   ErrorCode = "SESSION_CREATE_FAILED"
	ErrCodeSessionExpired  ErrorCode = "SESSION_EXPIRED"

	// Skill errors
	ErrCodeSkillNotFound  ErrorCode = "SKILL_NOT_FOUND"
	ErrCodeSkillLoad      ErrorCode = "SKILL_LOAD_FAILED"
	ErrCodeSkillExecution ErrorCode = "SKILL_EXECUTION_FAILED"

	// Config errors
	ErrCodeConfigNotFound ErrorCode = "CONFIG_NOT_FOUND"
	ErrCodeConfigInvalid  ErrorCode = "CONFIG_INVALID"
)

Error codes

Jump to

Keyboard shortcuts

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