errors

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: MIT Imports: 2 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 an error is an authentication error

func IsClientError

func IsClientError(err error) bool

IsClientError checks if an error is a client error

func IsConfigError

func IsConfigError(err error) bool

IsConfigError checks if an error is a configuration error

func IsContextError

func IsContextError(err error) bool

IsContextError checks if an error is a context error

func IsErrorOfType

func IsErrorOfType(err error, errorType ErrorType) bool

IsErrorOfType checks if an error is of a specific type

func IsIOError

func IsIOError(err error) bool

IsIOError checks if an error is an I/O error

func IsOperationError

func IsOperationError(err error) bool

IsOperationError checks if an error is an operation error

func IsSystemError

func IsSystemError(err error) bool

IsSystemError checks if an error is a system error

func IsValidationError

func IsValidationError(err error) bool

IsValidationError checks if an error is a validation error

Types

type DomainError

type DomainError struct {
	Type      ErrorType
	Domain    string
	Message   string
	Cause     error
	Timestamp time.Time
	Details   map[string]interface{}
}

DomainError is the base error type for domain-specific errors

func NewAuthError

func NewAuthError(domain, message string, cause error) *DomainError

NewAuthError creates a new authentication error

func NewClientError

func NewClientError(domain, message string, cause error) *DomainError

NewClientError creates a new client initialization error

func NewConfigError

func NewConfigError(domain, message string, cause error) *DomainError

NewConfigError creates a new configuration error

func NewContextError

func NewContextError(domain, message string, cause error) *DomainError

NewContextError creates a new context error

func NewIOError

func NewIOError(domain, message string, cause error) *DomainError

NewIOError creates a new input/output error

func NewOperationError

func NewOperationError(domain, message string, cause error) *DomainError

NewOperationError creates a new operation error

func NewSystemError

func NewSystemError(domain, message string, cause error) *DomainError

NewSystemError creates a new system-level error

func NewValidationError

func NewValidationError(domain, message string, cause error) *DomainError

NewValidationError creates a new validation error

func (*DomainError) Error

func (e *DomainError) Error() string

Error implements the error interface

func (*DomainError) Unwrap

func (e *DomainError) Unwrap() error

Unwrap returns the cause of the error

func (*DomainError) WithDetail

func (e *DomainError) WithDetail(key string, value interface{}) *DomainError

WithDetail adds a detail to the error

type ErrorType

type ErrorType string

ErrorType represents different categories of errors

const (
	// AuthError represents authentication/authorization errors
	AuthError ErrorType = "auth"

	// ConfigError represents configuration errors
	ConfigError ErrorType = "config"

	// ClientError represents client initialization errors
	ClientError ErrorType = "client"

	// OperationError represents errors during operations
	OperationError ErrorType = "operation"

	// ValidationError represents validation errors
	ValidationError ErrorType = "validation"

	// IOError represents input/output errors
	IOError ErrorType = "io"

	// ContextError represents context-related errors
	ContextError ErrorType = "context"

	// SystemError represents system-level errors
	SystemError ErrorType = "system"

	// UnknownError represents unclassified errors
	UnknownError ErrorType = "unknown"
)

Jump to

Keyboard shortcuts

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