errors

package
v0.4.2 Latest Latest
Warning

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

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

Documentation

Overview

Package errors provides domain-specific error types for the SDK. All error types support error unwrapping via errors.As() and errors.Is().

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToErrorDetail

func ToErrorDetail(err error) *entities.ErrorDetail

ToErrorDetail converts a Go error to our structured ErrorDetail. This function recognizes custom error types and categorizes them appropriately.

Types

type CapabilityError

type CapabilityError struct {
	Required string // Required capability (e.g., "network:outbound", "exec")
	Pattern  string // Optional: specific pattern that was denied
}

CapabilityError represents a capability check failure.

func (*CapabilityError) Error

func (e *CapabilityError) Error() string

func (*CapabilityError) ToErrorDetail

func (e *CapabilityError) ToErrorDetail() *entities.ErrorDetail

ToErrorDetail implements DetailedError.

type ConfigError

type ConfigError struct {
	Err   error
	Field string
}

ConfigError represents a configuration validation error.

func (*ConfigError) Error

func (e *ConfigError) Error() string

func (*ConfigError) ToErrorDetail

func (e *ConfigError) ToErrorDetail() *entities.ErrorDetail

ToErrorDetail implements DetailedError.

func (*ConfigError) Unwrap

func (e *ConfigError) Unwrap() error

type DNSError

type DNSError struct {
	Err        error
	Hostname   string
	RecordType string
	Nameserver string
}

DNSError represents a DNS lookup failure.

func (*DNSError) Error

func (e *DNSError) Error() string

func (*DNSError) Timeout

func (e *DNSError) Timeout() bool

func (*DNSError) ToErrorDetail

func (e *DNSError) ToErrorDetail() *entities.ErrorDetail

ToErrorDetail implements DetailedError.

func (*DNSError) Unwrap

func (e *DNSError) Unwrap() error

type DetailedError

type DetailedError interface {
	error
	ToErrorDetail() *entities.ErrorDetail
}

DetailedError is an interface for custom error types that can convert themselves to a structured ErrorDetail. This follows the Open/Closed Principle - new error types only need to implement this interface without modifying ToErrorDetail.

type ErrorDetail

type ErrorDetail = entities.ErrorDetail

ErrorDetail is an alias to entities.ErrorDetail for backward compatibility/convenience.

type ExecError

type ExecError struct {
	Err      error
	Command  string
	Stderr   string
	ExitCode int
}

ExecError represents a command execution error.

func (*ExecError) Error

func (e *ExecError) Error() string

func (*ExecError) ToErrorDetail

func (e *ExecError) ToErrorDetail() *entities.ErrorDetail

ToErrorDetail implements DetailedError.

func (*ExecError) Unwrap

func (e *ExecError) Unwrap() error

type HTTPError

type HTTPError struct {
	Err        error
	Method     string
	URL        string
	StatusCode int
}

HTTPError represents an HTTP request failure.

func (*HTTPError) Error

func (e *HTTPError) Error() string

func (*HTTPError) Timeout

func (e *HTTPError) Timeout() bool

func (*HTTPError) ToErrorDetail

func (e *HTTPError) ToErrorDetail() *entities.ErrorDetail

ToErrorDetail implements DetailedError.

func (*HTTPError) Unwrap

func (e *HTTPError) Unwrap() error

type MemoryError

type MemoryError struct {
	Requested int // Requested allocation size
	Current   int // Current total allocated
	Limit     int // Maximum allowed
}

MemoryError represents a memory allocation failure.

func (*MemoryError) Error

func (e *MemoryError) Error() string

func (*MemoryError) ToErrorDetail

func (e *MemoryError) ToErrorDetail() *entities.ErrorDetail

ToErrorDetail implements DetailedError.

type NetworkError

type NetworkError struct {
	Err       error
	Operation string
	Target    string
}

NetworkError represents a network operation failure.

func (*NetworkError) Error

func (e *NetworkError) Error() string

func (*NetworkError) ToErrorDetail

func (e *NetworkError) ToErrorDetail() *entities.ErrorDetail

ToErrorDetail implements DetailedError.

func (*NetworkError) Unwrap

func (e *NetworkError) Unwrap() error

type SchemaError

type SchemaError struct {
	Err  error
	Type string
}

SchemaError represents a schema generation or validation error.

func (*SchemaError) Error

func (e *SchemaError) Error() string

func (*SchemaError) ToErrorDetail

func (e *SchemaError) ToErrorDetail() *entities.ErrorDetail

ToErrorDetail implements DetailedError.

func (*SchemaError) Unwrap

func (e *SchemaError) Unwrap() error

type TCPError

type TCPError struct {
	Err     error
	Network string
	Address string
}

TCPError represents a TCP connection failure.

func (*TCPError) Error

func (e *TCPError) Error() string

func (*TCPError) Timeout

func (e *TCPError) Timeout() bool

func (*TCPError) ToErrorDetail

func (e *TCPError) ToErrorDetail() *entities.ErrorDetail

ToErrorDetail implements DetailedError.

func (*TCPError) Unwrap

func (e *TCPError) Unwrap() error

type TimeoutError

type TimeoutError struct {
	Operation string
	Target    string
	Duration  time.Duration
}

TimeoutError represents a timeout during an operation.

func (*TimeoutError) Error

func (e *TimeoutError) Error() string

func (*TimeoutError) Timeout

func (e *TimeoutError) Timeout() bool

func (*TimeoutError) ToErrorDetail

func (e *TimeoutError) ToErrorDetail() *entities.ErrorDetail

ToErrorDetail implements DetailedError.

type WireFormatError

type WireFormatError struct {
	Err       error
	Operation string
	Type      string
}

WireFormatError represents a wire format encoding/decoding error.

func (*WireFormatError) Error

func (e *WireFormatError) Error() string

func (*WireFormatError) ToErrorDetail

func (e *WireFormatError) ToErrorDetail() *entities.ErrorDetail

ToErrorDetail implements DetailedError.

func (*WireFormatError) Unwrap

func (e *WireFormatError) Unwrap() error

Jump to

Keyboard shortcuts

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