errors

package
v2.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEventNotReady = New(ErrCodeEventNotReady, "event not ready yet")

Functions

This section is empty.

Types

type Error

type Error struct {
	Code    ErrorCode
	Message string
	Cause   error
	Context map[string]any
}

Error represents a structured error in eCapture.

func New

func New(code ErrorCode, message string) *Error

New creates a new Error with the given code and message.

func NewConfigurationError

func NewConfigurationError(message string, cause error) *Error

NewConfigurationError creates a configuration error.

func NewEBPFAttachError

func NewEBPFAttachError(probe string, cause error) *Error

NewEBPFAttachError creates an eBPF attach error.

func NewEBPFLoadError

func NewEBPFLoadError(program string, cause error) *Error

NewEBPFLoadError creates an eBPF load error.

func NewEventDecodeError

func NewEventDecodeError(eventType string, cause error) *Error

NewEventDecodeError creates an event decode error.

func NewEventDispatchError

func NewEventDispatchError(cause error) *Error

NewEventDispatchError creates an event dispatch error.

func NewProbeCloseError

func NewProbeCloseError(probeName string, cause error) *Error

NewProbeCloseError creates a probe close error.

func NewProbeInitError

func NewProbeInitError(probeName string, cause error) *Error

NewProbeInitError creates a probe initialization error.

func NewProbeStartError

func NewProbeStartError(probeName string, cause error) *Error

NewProbeStartError creates a probe start error.

func NewProbeStopError

func NewProbeStopError(probeName string, cause error) *Error

NewProbeStopError creates a probe stop error.

func NewResourceNotFoundError

func NewResourceNotFoundError(resource string) *Error

NewResourceNotFoundError creates a resource not found error.

func Wrap

func Wrap(code ErrorCode, message string, cause error) *Error

Wrap wraps an existing error with additional context.

func (*Error) Error

func (e *Error) Error() string

Error implements the error interface.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the underlying error.

func (*Error) WithContext

func (e *Error) WithContext(key string, value any) *Error

WithContext adds contextual information to the error.

type ErrorCode

type ErrorCode int

ErrorCode defines standardized error codes for eCapture.

const (
	ErrCodeConfiguration ErrorCode = 100 + iota
	ErrCodeConfigValidation
	ErrCodeConfigMissing
)

Configuration errors (1xx)

const (
	ErrCodeProbeInit ErrorCode = 200 + iota
	ErrCodeProbeStart
	ErrCodeProbeStop
	ErrCodeProbeClose
)

Probe lifecycle errors (2xx)

const (
	ErrCodeEventDecode ErrorCode = 300 + iota
	ErrCodeEventDispatch
	ErrCodeEventValidation
	ErrCodeEventNotReady
)

Event processing errors (3xx)

const (
	ErrCodeEBPFLoad ErrorCode = 400 + iota
	ErrCodeEBPFAttach
	ErrCodeEBPFMapAccess
)

eBPF errors (4xx)

const (
	ErrCodeResourceNotFound ErrorCode = 500 + iota
	ErrCodeResourceAllocation
	ErrCodeResourceCleanup
)

Resource errors (5xx)

const (
	// ErrCodeUnknown represents an unknown error.
	ErrCodeUnknown ErrorCode = iota
)

Jump to

Keyboard shortcuts

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