Documentation
¶
Index ¶
- func IsRecoverable(err error) bool
- func NewContextualError(operation, resource, file string, cause error) error
- func NewDatabaseError(operation, table string, err error) error
- func NewFileOperationError(path, operation string, err error) error
- func NewGeneratorError(operation, resource string, err error) error
- func NewSpecificFileOperationError(path, operation string, err error) error
- func NewTemplateError(templateName, operation string, err error) error
- func NewValidationError(field, value, reason string, cause error) error
- func WrapDatabaseError(err error, operation, table string) error
- func WrapError(err error, ctx ErrorContext) error
- func WrapErrorWithCaller(err error, ctx ErrorContext) error
- func WrapFileError(err error, operation, filePath string) error
- func WrapGenerationError(err error, operation, resource string) error
- func WrapTemplateError(err error, operation, templateName string) error
- func WrapValidationError(err error, field, value string) error
- type ContextualError
- type DatabaseError
- type DefaultErrorRecovery
- type ErrorBuilder
- func (eb *ErrorBuilder) Detail(key string, value interface{}) *ErrorBuilder
- func (eb *ErrorBuilder) File(file string) *ErrorBuilder
- func (eb *ErrorBuilder) New(message string) error
- func (eb *ErrorBuilder) Operation(operation string) *ErrorBuilder
- func (eb *ErrorBuilder) Resource(resource string) *ErrorBuilder
- func (eb *ErrorBuilder) Wrap(err error) error
- type ErrorContext
- type ErrorRecovery
- type FileOperationError
- type GenerationError
- type TemplateError
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRecoverable ¶
IsRecoverable checks if an error is recoverable
func NewContextualError ¶
NewContextualError creates a new contextual error
func NewDatabaseError ¶
func NewFileOperationError ¶
func NewGeneratorError ¶
func NewTemplateError ¶
func NewValidationError ¶
func WrapDatabaseError ¶
WrapDatabaseError wraps a database error
func WrapError ¶
func WrapError(err error, ctx ErrorContext) error
WrapError wraps an error with context
func WrapErrorWithCaller ¶
func WrapErrorWithCaller(err error, ctx ErrorContext) error
WrapErrorWithCaller wraps an error with context and caller information
func WrapFileError ¶
WrapFileError wraps a file operation error
func WrapGenerationError ¶
WrapGenerationError wraps a generation error
func WrapTemplateError ¶
WrapTemplateError wraps a template error
func WrapValidationError ¶
WrapValidationError wraps a validation error
Types ¶
type ContextualError ¶
type ContextualError struct {
Context *ErrorContext `json:"context"`
Cause error `json:"cause"`
}
ContextualError provides enhanced error information with context
func (*ContextualError) Error ¶
func (e *ContextualError) Error() string
Error implements the error interface
func (*ContextualError) Unwrap ¶
func (e *ContextualError) Unwrap() error
Unwrap returns the underlying cause
type DatabaseError ¶
func (*DatabaseError) Error ¶
func (e *DatabaseError) Error() string
func (*DatabaseError) Unwrap ¶
func (e *DatabaseError) Unwrap() error
type DefaultErrorRecovery ¶
type DefaultErrorRecovery struct{}
DefaultErrorRecovery provides basic error recovery strategies
func (*DefaultErrorRecovery) CanRecover ¶
func (der *DefaultErrorRecovery) CanRecover(err error) bool
CanRecover determines if an error is recoverable
func (*DefaultErrorRecovery) Recover ¶
func (der *DefaultErrorRecovery) Recover(err error) error
Recover attempts to recover from an error
type ErrorBuilder ¶
type ErrorBuilder struct {
// contains filtered or unexported fields
}
ErrorBuilder provides a fluent interface for building contextual errors
func NewErrorBuilder ¶
func NewErrorBuilder() *ErrorBuilder
NewErrorBuilder creates a new error builder
func (*ErrorBuilder) Detail ¶
func (eb *ErrorBuilder) Detail(key string, value interface{}) *ErrorBuilder
Detail adds a detail
func (*ErrorBuilder) File ¶
func (eb *ErrorBuilder) File(file string) *ErrorBuilder
File sets the file
func (*ErrorBuilder) New ¶
func (eb *ErrorBuilder) New(message string) error
New creates a new error with the built context
func (*ErrorBuilder) Operation ¶
func (eb *ErrorBuilder) Operation(operation string) *ErrorBuilder
Operation sets the operation
func (*ErrorBuilder) Resource ¶
func (eb *ErrorBuilder) Resource(resource string) *ErrorBuilder
Resource sets the resource
func (*ErrorBuilder) Wrap ¶
func (eb *ErrorBuilder) Wrap(err error) error
Wrap wraps an error with the built context
type ErrorContext ¶
type ErrorContext struct {
Operation string `json:"operation"`
Resource string `json:"resource"`
File string `json:"file"`
Details map[string]interface{} `json:"details"`
}
ErrorContext provides context for error wrapping
func NewErrorContext ¶
func NewErrorContext(operation, resource, file string) *ErrorContext
NewErrorContext creates a new error context
func (*ErrorContext) WithCaller ¶
func (ec *ErrorContext) WithCaller(skip int) *ErrorContext
WithCaller adds caller information to the error context
func (*ErrorContext) WithDetail ¶
func (ec *ErrorContext) WithDetail(key string, value interface{}) *ErrorContext
WithDetail adds a detail to the error context
type ErrorRecovery ¶
ErrorRecovery defines strategies for error recovery
type FileOperationError ¶
func (*FileOperationError) Error ¶
func (e *FileOperationError) Error() string
func (*FileOperationError) Unwrap ¶
func (e *FileOperationError) Unwrap() error
type GenerationError ¶
func (*GenerationError) Error ¶
func (e *GenerationError) Error() string
func (*GenerationError) Unwrap ¶
func (e *GenerationError) Unwrap() error
type TemplateError ¶
func (*TemplateError) Error ¶
func (e *TemplateError) Error() string
func (*TemplateError) Unwrap ¶
func (e *TemplateError) Unwrap() error
type ValidationError ¶
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
func (*ValidationError) Unwrap ¶
func (e *ValidationError) Unwrap() error