Documentation
¶
Index ¶
- func CombineValidationErrors(errors []ValidationError) error
- func IsCategory(err error, category ErrorCategory) bool
- type ErrorCategory
- type GitOperationError
- func NewGitBranchError(branch string, operation string, reason string, output string) *GitOperationError
- func NewGitCheckoutError(ref string, reason string, output string) *GitOperationError
- func NewGitCommandError(command string, args []string, reason string, output string) *GitOperationError
- func NewGitMergeError(branch string, reason string, output string) *GitOperationError
- func NewGitPullError(branch string, remote string, reason string, output string) *GitOperationError
- func NewGitPushError(branch string, remote string, reason string, output string) *GitOperationError
- type HitchError
- func AsHitchError(err error) (*HitchError, bool)
- func NewGitOperationError(message string, details string, err error) *HitchError
- func NewMetadataError(message string, details string, err error) *HitchError
- func NewRepositoryError(message string, details string) *HitchError
- func NewSystemError(message string, err error) *HitchError
- func NewUserInputError(message string, details ...string) *HitchError
- func NewValidationError(message string, details ...string) *HitchError
- type MergeConflictError
- type ValidationError
- func NewBranchValidationError(branchName string, reason string) *ValidationError
- func NewCommitMessageValidationError(message string, reason string) *ValidationError
- func NewEmailValidationError(email string, reason string) *ValidationError
- func NewEnvironmentValidationError(envName string, reason string) *ValidationError
- type ValidationResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CombineValidationErrors ¶
func CombineValidationErrors(errors []ValidationError) error
CombineValidationErrors combines multiple validation errors into a single error
func IsCategory ¶
func IsCategory(err error, category ErrorCategory) bool
IsCategory checks if an error belongs to a specific category
Types ¶
type ErrorCategory ¶
type ErrorCategory int
Error categories for consistent error handling
const ( // CategoryUnknown is for uncategorized errors CategoryUnknown ErrorCategory = iota // CategoryValidation is for input validation errors CategoryValidation // CategoryGitOperation is for git-related operation errors CategoryGitOperation // CategoryUserInput is for user-provided input errors CategoryUserInput // CategorySystem is for system-level errors (filesystem, permissions, etc.) CategorySystem // CategoryMetadata is for metadata-related errors CategoryMetadata // CategoryRepository is for repository state errors CategoryRepository )
func GetCategory ¶
func GetCategory(err error) ErrorCategory
GetCategory extracts the category from an error
func (ErrorCategory) String ¶
func (c ErrorCategory) String() string
String implements the Stringer interface for the category
type GitOperationError ¶
type GitOperationError struct {
Operation string
Target string
Reason string
Output string
ExitCode int
}
GitOperationError represents git-specific operation errors
func NewGitBranchError ¶
func NewGitBranchError(branch string, operation string, reason string, output string) *GitOperationError
NewGitBranchError creates a git branch operation error
func NewGitCheckoutError ¶
func NewGitCheckoutError(ref string, reason string, output string) *GitOperationError
NewGitCheckoutError creates a git checkout error
func NewGitCommandError ¶
func NewGitCommandError(command string, args []string, reason string, output string) *GitOperationError
NewGitCommandError creates a generic git command error
func NewGitMergeError ¶
func NewGitMergeError(branch string, reason string, output string) *GitOperationError
NewGitMergeError creates a git merge error
func NewGitPullError ¶
func NewGitPullError(branch string, remote string, reason string, output string) *GitOperationError
NewGitPullError creates a git pull error
func NewGitPushError ¶
func NewGitPushError(branch string, remote string, reason string, output string) *GitOperationError
NewGitPushError creates a git push error
func (*GitOperationError) Error ¶
func (e *GitOperationError) Error() string
func (*GitOperationError) Unwrap ¶
func (e *GitOperationError) Unwrap() error
Unwrap implements error unwrapping
type HitchError ¶
type HitchError struct {
Category ErrorCategory
Message string
Details string
Underlying error
Context map[string]interface{}
}
HitchError is the base error type for all Hitch-specific errors
func AsHitchError ¶ added in v1.1.10
func AsHitchError(err error) (*HitchError, bool)
AsHitchError extracts a HitchError from a standard error
func NewGitOperationError ¶
func NewGitOperationError(message string, details string, err error) *HitchError
NewGitOperationError creates a git operation error
func NewMetadataError ¶
func NewMetadataError(message string, details string, err error) *HitchError
NewMetadataError creates a metadata error
func NewRepositoryError ¶
func NewRepositoryError(message string, details string) *HitchError
NewRepositoryError creates a repository state error
func NewSystemError ¶
func NewSystemError(message string, err error) *HitchError
NewSystemError creates a system error
func NewUserInputError ¶
func NewUserInputError(message string, details ...string) *HitchError
NewUserInputError creates a user input error
func NewValidationError ¶
func NewValidationError(message string, details ...string) *HitchError
NewValidationError creates a validation error
func (*HitchError) GetContext ¶
func (e *HitchError) GetContext(key string) (interface{}, bool)
GetContext retrieves context information from an error
func (*HitchError) Unwrap ¶
func (e *HitchError) Unwrap() error
Unwrap returns the underlying error for error unwrapping
func (*HitchError) WithContext ¶
func (e *HitchError) WithContext(key string, value interface{}) *HitchError
WithContext adds context information to an error
type MergeConflictError ¶
MergeConflictError represents merge conflicts
func NewMergeConflictError ¶
func NewMergeConflictError(branch string, message string, conflictFiles []string) *MergeConflictError
NewMergeConflictError creates a merge conflict error
func (*MergeConflictError) Error ¶
func (e *MergeConflictError) Error() string
type ValidationError ¶
ValidationError holds specific validation error details
func NewBranchValidationError ¶
func NewBranchValidationError(branchName string, reason string) *ValidationError
NewBranchValidationError creates a branch validation error
func NewCommitMessageValidationError ¶
func NewCommitMessageValidationError(message string, reason string) *ValidationError
NewCommitMessageValidationError creates a commit message validation error
func NewEmailValidationError ¶
func NewEmailValidationError(email string, reason string) *ValidationError
NewEmailValidationError creates an email validation error
func NewEnvironmentValidationError ¶
func NewEnvironmentValidationError(envName string, reason string) *ValidationError
NewEnvironmentValidationError creates an environment validation error
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
type ValidationResult ¶
type ValidationResult struct {
Errors []ValidationError
Valid bool
Details map[string]interface{}
}
ValidationResult contains multiple validation errors
func (*ValidationResult) Error ¶
func (vr *ValidationResult) Error() string