Documentation
¶
Overview ¶
Package errors provides error related functions and types
Index ¶
- Variables
- func IsNotFound(err error) bool
- func IsTLSCertificateError(err error) bool
- func IsTemporary(err error) bool
- func IsUnauthorized(err error) bool
- func Wrap(err error, operation string) error
- func WrapTLSError(err error) error
- func Wrapf(err error, format string, args ...any) error
- type APIError
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // System Errors ErrSystemNotReady = errors.New("system not ready") ErrElementNotFound = errors.New("element not found") ErrNoNamedConfigSupport = errors.New("backend does not support named configs") ErrTLSCertificate = errors.New("TLS certificate validation failed") // API Errors ErrAPIRequestFailed = errors.New("API request failed") ErrAPINotFound = errors.New("API resource not found") ErrAPIConflict = errors.New("API resource conflict") ErrAPIServerError = errors.New("API server error") // Validation Errors ErrValidationFailed = errors.New("validation failed") ErrInvalidInput = errors.New("invalid input") ErrMissingRequired = errors.New("missing required field") // Authentication Errors ErrAuthFailed = errors.New("authentication failed") ErrTokenExpired = errors.New("authentication token expired") ErrTokenInvalid = errors.New("authentication token invalid") // Network/Connection Errors ErrConnectionFailed = errors.New("connection failed") ErrTimeout = errors.New("operation timeout") )
Sentinel Errors
Functions ¶
func IsNotFound ¶
IsNotFound checks if error indicates resource not found
func IsTLSCertificateError ¶
IsTLSCertificateError checks if an error is a TLS/certificate validation error
func IsTemporary ¶
IsTemporary checks if error is temporary and operation can be retried
func IsUnauthorized ¶
IsUnauthorized checks if error indicates authentication failure
func WrapTLSError ¶
WrapTLSError wraps a TLS error with a clear sentinel value
Types ¶
type APIError ¶
type APIError struct {
Operation string `json:"operation"`
StatusCode int `json:"status_code"`
Message string `json:"message"`
Cause error `json:"-"`
}
APIError represents a structured API error response
func NewAPIError ¶
NewAPIError creates a structured API error
type ValidationError ¶
type ValidationError struct {
Field string `json:"field"`
Value any `json:"value,omitempty"`
Reason string `json:"reason"`
Cause error `json:"-"`
}
ValidationError represents a structured validation error
func NewValidationError ¶
func NewValidationError(field string, value any, reason string, cause error) *ValidationError
NewValidationError creates a structured validation error
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
func (*ValidationError) Unwrap ¶
func (e *ValidationError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.