Versions in this module Expand all Collapse all v1 v1.4.0 Sep 26, 2025 Changes in this version + const ErrorTypeAudit + const ErrorTypeCache + const ErrorTypeConfiguration + const ErrorTypeDependency + const ErrorTypeFileSystem + const ErrorTypeGeneration + const ErrorTypeInternal + const ErrorTypeNetwork + const ErrorTypePermission + const ErrorTypeSecurity + const ErrorTypeTemplate + const ErrorTypeUser + const ErrorTypeValidation + const ErrorTypeVersion + const ExitCodeAuditFailed + const ExitCodeCacheError + const ExitCodeConfigurationInvalid + const ExitCodeDependencyError + const ExitCodeFileSystemError + const ExitCodeGeneral + const ExitCodeGenerationFailed + const ExitCodeInternalError + const ExitCodeNetworkError + const ExitCodePermissionDenied + const ExitCodeSecurityError + const ExitCodeSuccess + const ExitCodeTemplateNotFound + const ExitCodeUserError + const ExitCodeValidationFailed + const ExitCodeVersionError + func FormatErrorForUser(err *CLIError, verbose bool) string + func GetCallerInfo(skip int) (string, int) + func InitializeGlobalErrorHandler(config *ErrorHandlerConfig) error + func PropagateError(err error, context string) error + type CIEnvironment struct + BuildID string + IsCI bool + JobID string + Provider string + type CLIError struct + Cause error + Code int + Context *ErrorContext + Details map[string]interface{} + Message string + Recoverable bool + Severity Severity + Stack string + Suggestions []string + Timestamp time.Time + Type string + func ChainErrors(errors []error, operation string) *CLIError + func NewAuditError(message string, auditType string, score float64, cause error) *CLIError + func NewCLIError(errorType, message string, code int) *CLIError + func NewCacheError(message string, cacheKey string, cause error) *CLIError + func NewConfigurationError(message string, configPath string, cause error) *CLIError + func NewDependencyError(message string, dependency string, version string, cause error) *CLIError + func NewFileSystemError(message string, path string, operation string, cause error) *CLIError + func NewGenerationError(message string, component string, operation string, cause error) *CLIError + func NewInternalError(message string, component string, cause error) *CLIError + func NewNetworkError(message string, url string, cause error) *CLIError + func NewPermissionError(message string, path string, requiredPermission string, cause error) *CLIError + func NewSecurityError(message string, securityIssue string, severity string, cause error) *CLIError + func NewTemplateError(message string, templateName string, cause error) *CLIError + func NewUserError(message string, userInput string, expectedFormat string) *CLIError + func NewValidationError(message string, field string, value interface{}) *CLIError + func NewVersionError(message string, component string, cause error) *CLIError + func WrapError(err error, errorType string, message string, code int) *CLIError + func (e *CLIError) Error() string + func (e *CLIError) ExitCode() int + func (e *CLIError) GetSeverity() Severity + func (e *CLIError) IsRecoverable() bool + func (e *CLIError) ToJSON() ([]byte, error) + func (e *CLIError) Unwrap() error + func (e *CLIError) WithCause(cause error) *CLIError + func (e *CLIError) WithContext(ctx *ErrorContext) *CLIError + func (e *CLIError) WithDetails(key string, value interface{}) *CLIError + func (e *CLIError) WithRecoverable(recoverable bool) *CLIError + func (e *CLIError) WithSeverity(severity Severity) *CLIError + func (e *CLIError) WithSuggestions(suggestions ...string) *CLIError + type CacheRecoveryStrategy struct + func (s *CacheRecoveryStrategy) CanRecover(err *CLIError) bool + func (s *CacheRecoveryStrategy) GetDescription() string + func (s *CacheRecoveryStrategy) Recover(err *CLIError) (*RecoveryResult, error) + type CallerInfo struct + File string + Function string + Line int + type CategoryAnalysis struct + Category *ErrorCategory + Count int + Percentage float64 + Trend string + type ConfigurationRecoveryStrategy struct + func (s *ConfigurationRecoveryStrategy) CanRecover(err *CLIError) bool + func (s *ConfigurationRecoveryStrategy) GetDescription() string + func (s *ConfigurationRecoveryStrategy) Recover(err *CLIError) (*RecoveryResult, error) + type ContextualErrorBuilder struct + func NewContextualError(errorType, message string, code int) *ContextualErrorBuilder + func (b *ContextualErrorBuilder) Build() *CLIError + func (b *ContextualErrorBuilder) WithCause(cause error) *ContextualErrorBuilder + func (b *ContextualErrorBuilder) WithCommand(command string, args []string, flags map[string]string) *ContextualErrorBuilder + func (b *ContextualErrorBuilder) WithComponent(component string) *ContextualErrorBuilder + func (b *ContextualErrorBuilder) WithDetail(key string, value interface{}) *ContextualErrorBuilder + func (b *ContextualErrorBuilder) WithEnvironment(env string, ci *CIEnvironment) *ContextualErrorBuilder + func (b *ContextualErrorBuilder) WithFile(file string, line int) *ContextualErrorBuilder + func (b *ContextualErrorBuilder) WithOperation(operation string) *ContextualErrorBuilder + func (b *ContextualErrorBuilder) WithRecoverable(recoverable bool) *ContextualErrorBuilder + func (b *ContextualErrorBuilder) WithSeverity(severity Severity) *ContextualErrorBuilder + func (b *ContextualErrorBuilder) WithSuggestion(suggestion string) *ContextualErrorBuilder + func (b *ContextualErrorBuilder) WithWorkingDirectory(dir string) *ContextualErrorBuilder + type ContextualSuggestionGenerator struct + func NewContextualSuggestionGenerator() *ContextualSuggestionGenerator + func (g *ContextualSuggestionGenerator) GenerateSuggestions(err *CLIError) []string + type EnvironmentInfo struct + Arch string + CI *CIEnvironment + Environment map[string]string + GeneratorVersion string + GoVersion string + OS string + WorkingDir string + type ErrorAnalysisReport struct + Categories []CategoryAnalysis + GeneratedAt time.Time + Recommendations []string + RecoveryRate float64 + SeverityBreakdown []SeverityAnalysis + TimeRange *TimeRange + TopPatterns []ErrorPattern + TotalErrors int + type ErrorCategorizer struct + func NewErrorCategorizer() *ErrorCategorizer + func (ec *ErrorCategorizer) CategorizeError(err *CLIError) *ErrorCategory + func (ec *ErrorCategorizer) GenerateErrorReport() *ErrorAnalysisReport + func (ec *ErrorCategorizer) GetCategories() map[string]*ErrorCategory + func (ec *ErrorCategorizer) GetSeverityLevels() []SeverityLevel + func (ec *ErrorCategorizer) GetStatistics() *ErrorStatistics + func (ec *ErrorCategorizer) RecordError(err *CLIError) + func (ec *ErrorCategorizer) RegisterCategory(category *ErrorCategory) + func (ec *ErrorCategorizer) Reset() + type ErrorCategory struct + Description string + Name string + Recoverable bool + Severity Severity + Types []string + type ErrorContext struct + Arguments []string + CI *CIEnvironment + Command string + Component string + Environment string + File string + Flags map[string]string + Line int + Operation string + WorkingDir string + type ErrorContextCollector struct + func NewErrorContextCollector() *ErrorContextCollector + func (c *ErrorContextCollector) CollectCommandContext(command string, args []string, flags map[string]string) *ErrorContext + func (c *ErrorContextCollector) CollectContext() *ErrorContext + type ErrorHandler struct + func GetGlobalErrorHandler() *ErrorHandler + func NewErrorHandler(config *ErrorHandlerConfig) (*ErrorHandler, error) + func (eh *ErrorHandler) Close() error + func (eh *ErrorHandler) GenerateAnalysisReport() *ErrorAnalysisReport + func (eh *ErrorHandler) GetLogPath() string + func (eh *ErrorHandler) GetRecoveryHistory() *RecoveryHistory + func (eh *ErrorHandler) GetReportPath() string + func (eh *ErrorHandler) GetStatistics() *ErrorStatistics + func (eh *ErrorHandler) HandleError(err error, context map[string]interface{}) *ErrorHandlingResult + func (eh *ErrorHandler) NewConfigurationErrorHandler(message, configPath string, cause error) *ErrorHandlingResult + func (eh *ErrorHandler) NewFileSystemErrorHandler(message, path, operation string, cause error) *ErrorHandlingResult + func (eh *ErrorHandler) NewGenerationErrorHandler(message, component, operation string, cause error) *ErrorHandlingResult + func (eh *ErrorHandler) NewNetworkErrorHandler(message, url string, cause error) *ErrorHandlingResult + func (eh *ErrorHandler) NewTemplateErrorHandler(message, templateName string, cause error) *ErrorHandlingResult + func (eh *ErrorHandler) NewValidationErrorHandler(message, field string, value interface{}) *ErrorHandlingResult + func (eh *ErrorHandler) SetLogLevel(level LogLevel) + func (eh *ErrorHandler) SetQuietMode(quiet bool) + func (eh *ErrorHandler) SetVerboseMode(verbose bool) + type ErrorHandlerConfig struct + AutoGenerateID bool + EnableRecovery bool + EnableReporting bool + LogFormat string + LogLevel LogLevel + LogPath string + MaxReports int + QuietMode bool + ReportFormat ReportFormat + ReportPath string + VerboseMode bool + func DefaultErrorHandlerConfig() *ErrorHandlerConfig + type ErrorHandlingResult struct + Category *ErrorCategory + Duration time.Duration + Error *CLIError + ExitCode int + Recovery *RecoveryResult + ReportPath string + Success bool + Suggestions []string + func HandleGlobalError(err error, context map[string]interface{}) *ErrorHandlingResult + type ErrorLogData struct + Cause string + Code int + Context *ErrorContext + Details map[string]interface{} + Message string + Recoverable bool + Severity string + Stack string + Suggestions []string + Type string + type ErrorLogger struct + func NewErrorLogger(logPath string, level LogLevel, jsonFormat bool) (*ErrorLogger, error) + func (el *ErrorLogger) Close() error + func (el *ErrorLogger) Debug(message string, context map[string]interface{}) + func (el *ErrorLogger) Error(message string, context map[string]interface{}) + func (el *ErrorLogger) Fatal(message string, context map[string]interface{}) + func (el *ErrorLogger) Info(message string, context map[string]interface{}) + func (el *ErrorLogger) LogError(err *CLIError) + func (el *ErrorLogger) LogRecoveryAttempt(attempt *RecoveryAttempt) + func (el *ErrorLogger) SetContext(key string, value interface{}) + func (el *ErrorLogger) SetJSONFormat(jsonFormat bool) + func (el *ErrorLogger) SetLevel(level LogLevel) + func (el *ErrorLogger) Warn(message string, context map[string]interface{}) + type ErrorPattern struct + Count int + Pattern string + Percentage float64 + Suggestions []string + type ErrorReport struct + Context map[string]interface{} + Environment *EnvironmentInfo + Error *CLIError + ID string + Logs []LogEntry + Recovery *RecoveryAttempt + System *SystemInfo + Timestamp time.Time + type ErrorReporter struct + func NewErrorReporter(logger *ErrorLogger, reportDir string, maxReports int, format ReportFormat) *ErrorReporter + func (er *ErrorReporter) GenerateReport(err *CLIError, recovery *RecoveryAttempt, context map[string]interface{}) (*ErrorReport, error) + func (er *ErrorReporter) GetReportPath() string + func (er *ErrorReporter) ListReports() ([]string, error) + func (er *ErrorReporter) SaveReport(report *ErrorReport) (string, error) + type ErrorStatistics struct + CommonPatterns []ErrorPattern + ErrorsByCategory map[string]int + ErrorsByHour map[string]int + ErrorsBySeverity map[string]int + ErrorsByType map[string]int + FirstError *time.Time + LastError *time.Time + RecentErrors []*CLIError + RecoveryRate float64 + TotalErrors int + type FileSystemRecoveryStrategy struct + func (s *FileSystemRecoveryStrategy) CanRecover(err *CLIError) bool + func (s *FileSystemRecoveryStrategy) GetDescription() string + func (s *FileSystemRecoveryStrategy) Recover(err *CLIError) (*RecoveryResult, error) + type LogEntry struct + Caller *CallerInfo + Context map[string]interface{} + Error *ErrorLogData + Level string + Message string + Timestamp time.Time + type LogLevel int + const LogLevelDebug + const LogLevelError + const LogLevelFatal + const LogLevelInfo + const LogLevelWarn + func (l LogLevel) String() string + type LoggerAdapter struct + func NewLoggerAdapter(logger *ErrorLogger) *LoggerAdapter + func (la *LoggerAdapter) Debug(format string, args ...interface{}) + func (la *LoggerAdapter) Error(format string, args ...interface{}) + func (la *LoggerAdapter) Info(format string, args ...interface{}) + func (la *LoggerAdapter) Warn(format string, args ...interface{}) + type NetworkRecoveryStrategy struct + func (s *NetworkRecoveryStrategy) CanRecover(err *CLIError) bool + func (s *NetworkRecoveryStrategy) GetDescription() string + func (s *NetworkRecoveryStrategy) Recover(err *CLIError) (*RecoveryResult, error) + type RecoveryAction struct + Description string + Details map[string]interface{} + Success bool + Type string + type RecoveryAttempt struct + Duration time.Duration + Error *CLIError + Result *RecoveryResult + StartTime time.Time + Strategy string + type RecoveryHistory struct + func NewRecoveryHistory() *RecoveryHistory + func (rh *RecoveryHistory) GetAttempts() []RecoveryAttempt + func (rh *RecoveryHistory) GetFailedAttempts() []RecoveryAttempt + func (rh *RecoveryHistory) GetSuccessfulAttempts() []RecoveryAttempt + func (rh *RecoveryHistory) RecordAttempt(err *CLIError, strategy string, result *RecoveryResult, duration time.Duration) + type RecoveryLogger interface + Debug func(format string, args ...interface{}) + Error func(format string, args ...interface{}) + Info func(format string, args ...interface{}) + Warn func(format string, args ...interface{}) + type RecoveryManager struct + func NewRecoveryManager(logger RecoveryLogger) *RecoveryManager + func (rm *RecoveryManager) AttemptRecovery(err *CLIError) (*RecoveryResult, error) + func (rm *RecoveryManager) RegisterStrategy(strategy RecoveryStrategy) + type RecoveryResult struct + Actions []RecoveryAction + Details map[string]interface{} + Message string + Success bool + Suggestions []string + type RecoveryStrategy interface + CanRecover func(err *CLIError) bool + GetDescription func() string + Recover func(err *CLIError) (*RecoveryResult, error) + type ReportFormat string + const ReportFormatHTML + const ReportFormatJSON + const ReportFormatText + type Severity string + const SeverityCritical + const SeverityHigh + const SeverityLow + const SeverityMedium + type SeverityAnalysis struct + Count int + Percentage float64 + Severity SeverityLevel + type SeverityLevel struct + Color string + Description string + Icon string + Level Severity + Name string + Priority int + type SystemInfo struct + CPUCount int + DiskSpace int64 + Hostname string + MemoryUsage int64 + ParentPID int + ProcessID int + Username string + type TemplateRecoveryStrategy struct + func (s *TemplateRecoveryStrategy) CanRecover(err *CLIError) bool + func (s *TemplateRecoveryStrategy) GetDescription() string + func (s *TemplateRecoveryStrategy) Recover(err *CLIError) (*RecoveryResult, error) + type TimeRange struct + End *time.Time + Start *time.Time + type ValidationRecoveryStrategy struct + func (s *ValidationRecoveryStrategy) CanRecover(err *CLIError) bool + func (s *ValidationRecoveryStrategy) GetDescription() string + func (s *ValidationRecoveryStrategy) Recover(err *CLIError) (*RecoveryResult, error)