Documentation
¶
Overview ¶
Package errors provides standardized error formatting and types.
Index ¶
- type ErrorType
- type StandardError
- func New(errorType ErrorType, message string) *StandardError
- func NewConfigError(message string, args ...interface{}) *StandardError
- func NewFileError(message string, args ...interface{}) *StandardError
- func NewGitError(message string, args ...interface{}) *StandardError
- func NewValidationError(message string, args ...interface{}) *StandardError
- func Wrap(errorType ErrorType, message string, cause error) *StandardError
- func WrapConfigError(message string, cause error) *StandardError
- func WrapFileError(message string, cause error) *StandardError
- func WrapGitError(message string, cause error) *StandardError
- func WrapValidationError(message string, cause error) *StandardError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorType ¶
type ErrorType string
ErrorType represents different categories of errors
const ( // ValidationError represents validation failures ValidationError ErrorType = "validation" // ConfigError represents configuration issues ConfigError ErrorType = "config" // FileError represents file operation issues FileError ErrorType = "file" // GitError represents git-related issues GitError ErrorType = "git" // NetworkError represents network-related issues NetworkError ErrorType = "network" // InternalError represents internal application issues InternalError ErrorType = "internal" )
type StandardError ¶
type StandardError struct {
Type ErrorType
Message string
Cause error
Context map[string]interface{}
}
StandardError represents a formatted error with context
func New ¶
func New(errorType ErrorType, message string) *StandardError
New creates a new standardized error
func NewConfigError ¶
func NewConfigError(message string, args ...interface{}) *StandardError
NewConfigError creates a config error
func NewFileError ¶
func NewFileError(message string, args ...interface{}) *StandardError
NewFileError creates a file error
func NewGitError ¶
func NewGitError(message string, args ...interface{}) *StandardError
NewGitError creates a git error
func NewValidationError ¶
func NewValidationError(message string, args ...interface{}) *StandardError
NewValidationError creates a validation error
func Wrap ¶
func Wrap(errorType ErrorType, message string, cause error) *StandardError
Wrap wraps an existing error with context
func WrapConfigError ¶
func WrapConfigError(message string, cause error) *StandardError
WrapConfigError wraps a config error
func WrapFileError ¶
func WrapFileError(message string, cause error) *StandardError
WrapFileError wraps a file error
func WrapGitError ¶
func WrapGitError(message string, cause error) *StandardError
WrapGitError wraps a git error
func WrapValidationError ¶
func WrapValidationError(message string, cause error) *StandardError
WrapValidationError wraps a validation error
func (*StandardError) Error ¶
func (e *StandardError) Error() string
func (*StandardError) Unwrap ¶
func (e *StandardError) Unwrap() error
func (*StandardError) WithContext ¶
func (e *StandardError) WithContext(key string, value interface{}) *StandardError
WithContext adds context information to an error