Documentation
¶
Overview ¶
Package errors provides common error types and utilities for the Lux node.
Index ¶
- Variables
- func IsClosed(err error) bool
- func IsNotFound(err error) bool
- func IsPermanent(err error) bool
- func IsTemporary(err error) bool
- func IsTimeout(err error) bool
- func Join(errs ...error) error
- func Wrap(err error, category Category, message string) error
- func WrapWithContext(err error, category Category, message string, context map[string]interface{}) error
- type Category
- type Multi
- type WrappedError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Database errors ErrNotFound = errors.New("not found") ErrClosed = errors.New("closed") ErrCorrupted = errors.New("corrupted") ErrReadOnly = errors.New("read only") ErrDiskFull = errors.New("disk full") ErrInvalidKey = errors.New("invalid key") ErrInvalidValue = errors.New("invalid value") // Network errors ErrTimeout = errors.New("timeout") ErrConnectionClosed = errors.New("connection closed") ErrConnectionReset = errors.New("connection reset") ErrNoRoute = errors.New("no route to host") ErrRefused = errors.New("connection refused") ErrNetworkDown = errors.New("network down") // Validation errors ErrInvalidInput = errors.New("invalid input") ErrInvalidSignature = errors.New("invalid signature") ErrInvalidChecksum = errors.New("invalid checksum") ErrInvalidFormat = errors.New("invalid format") ErrMissingField = errors.New("missing required field") ErrFieldTooLarge = errors.New("field exceeds maximum size") // State errors ErrNotInitialized = errors.New("not initialized") ErrAlreadyExists = errors.New("already exists") ErrNotSupported = errors.New("not supported") ErrDeprecated = errors.New("deprecated") ErrConflict = errors.New("conflict") ErrCanceled = errors.New("canceled") // Resource errors ErrResourceExhausted = errors.New("resource exhausted") ErrQuotaExceeded = errors.New("quota exceeded") ErrRateLimited = errors.New("rate limited") ErrOutOfMemory = errors.New("out of memory") // Permission errors ErrForbidden = errors.New("forbidden") ErrAccessDenied = errors.New("access denied") )
Common sentinel errors used throughout the codebase
Functions ¶
func IsNotFound ¶
IsNotFound checks if an error is a "not found" error
func IsPermanent ¶
IsPermanent checks if an error is permanent and should not be retried
func IsTemporary ¶
IsTemporary checks if an error is temporary and can be retried
Types ¶
type Category ¶
type Category string
Error categories for grouping related errors
const ( CategoryDatabase Category = "database" CategoryNetwork Category = "network" CategoryValidation Category = "validation" CategoryState Category = "state" CategoryResource Category = "resource" CategoryPermission Category = "permission" CategoryInternal Category = "internal" CategoryUnknown Category = "unknown" )
func GetCategory ¶
GetCategory returns the category of an error
type Multi ¶
type Multi struct {
Errors []error
}
Multi combines multiple errors into a single error
type WrappedError ¶
type WrappedError struct {
Err error
Category Category
Message string
Context map[string]interface{}
}
WrappedError provides context around an error
func (*WrappedError) Error ¶
func (e *WrappedError) Error() string
Error implements the error interface
func (*WrappedError) Is ¶
func (e *WrappedError) Is(target error) bool
Is checks if the error matches a target error
func (*WrappedError) Unwrap ¶
func (e *WrappedError) Unwrap() error
Unwrap returns the underlying error
Click to show internal directories.
Click to hide internal directories.