Documentation
¶
Index ¶
- Constants
- func GetCallerInfo(skip int) string
- func IsAlreadyExists(err error) bool
- func IsConflict(err error) bool
- func IsForbidden(err error) bool
- func IsInvalid(err error) bool
- func IsNotFound(err error) bool
- func IsServerTimeout(err error) bool
- func IsServiceUnavailable(err error) bool
- func IsTimeout(err error) bool
- func IsTooManyRequests(err error) bool
- func MustNotError(err error)
- func NewAuthenticationError(resource string, err error) error
- func NewAuthorizationError(resource string, err error) error
- func NewConnectionError(endpoint string, err error) error
- func NewCreateResourceError(resource string, namespace string, err error) error
- func NewDeleteResourceError(resource string, namespace string, err error) error
- func NewError(message string) error
- func NewErrorf(format string, args ...interface{}) error
- func NewGetResourceError(resource string, namespace string, err error) error
- func NewListResourceError(resource string, namespace string, err error) error
- func NewPatchResourceError(resource string, namespace string, err error) error
- func NewReconcileError(resource string, namespace string, err error) error
- func NewTimeoutError(operation string, resource string, namespace string, err error) error
- func NewUpdateResourceError(resource string, namespace string, err error) error
- func NewValidationError(resource string, namespace string, err error) error
- func WithStack(err error) error
- func WrapError(err error, message string) error
- func WrapErrorf(err error, format string, args ...interface{}) error
- type ErrorCategory
- type ErrorHandler
- func (eh *ErrorHandler) HandleError(ctx context.Context, err error, resource coh.CoherenceResource, msg string) (reconcile.Result, error)
- func (eh *ErrorHandler) HandleResourceError(ctx context.Context, err error, resource coh.CoherenceResource, ...) (reconcile.Result, error)
- func (eh *ErrorHandler) LogAndReturnError(err error, msg string) error
- func (eh *ErrorHandler) LogAndWrapError(err error, msg string) error
- func (eh *ErrorHandler) LogAndWrapErrorf(err error, format string, args ...interface{}) error
- func (eh *ErrorHandler) RetryOnError(operation string, fn func() error) error
- func (eh *ErrorHandler) RetryWithContext(ctx context.Context, operation string, resource string, namespace string, ...) error
- type OperationError
Constants ¶
const ( // ErrorCategoryTransient represents a transient error that may resolve itself with time ErrorCategoryTransient ErrorCategory = "Transient" // ErrorCategoryPermanent represents a permanent error that requires manual intervention ErrorCategoryPermanent ErrorCategory = "Permanent" // ErrorCategoryRecoverable represents an error that can be automatically recovered from ErrorCategoryRecoverable ErrorCategory = "Recoverable" // ErrorCategoryUnknown represents an error of unknown category ErrorCategoryUnknown ErrorCategory = "Unknown" // AnnotationLastError is the annotation key for the last error message AnnotationLastError = "coherence.oracle.com/last-error" // AnnotationErrorCount is the annotation key for the error count AnnotationErrorCount = "coherence.oracle.com/error-count" // AnnotationLastRecoveryAttempt is the annotation key for the last recovery attempt timestamp AnnotationLastRecoveryAttempt = "coherence.oracle.com/last-recovery-attempt" )
Variables ¶
This section is empty.
Functions ¶
func GetCallerInfo ¶
GetCallerInfo returns the file and line number of the caller
func IsAlreadyExists ¶
IsAlreadyExists returns true if the error is an already exists error
func IsConflict ¶
IsConflict returns true if the error is a conflict error
func IsForbidden ¶
IsForbidden returns true if the error is a forbidden error
func IsNotFound ¶
IsNotFound returns true if the error is a not found error
func IsServerTimeout ¶
IsServerTimeout returns true if the error is a server timeout error
func IsServiceUnavailable ¶
IsServiceUnavailable returns true if the error is a service unavailable error
func IsTooManyRequests ¶
IsTooManyRequests returns true if the error is a too many requests error
func NewAuthenticationError ¶
NewAuthenticationError creates an error for authentication failures
func NewAuthorizationError ¶
NewAuthorizationError creates an error for authorization failures
func NewConnectionError ¶
NewConnectionError creates an error for connection failures
func NewCreateResourceError ¶
NewCreateResourceError creates an error for resource creation failures
func NewDeleteResourceError ¶
NewDeleteResourceError creates an error for resource deletion failures
func NewGetResourceError ¶
NewGetResourceError creates an error for resource retrieval failures
func NewListResourceError ¶
NewListResourceError creates an error for resource listing failures
func NewPatchResourceError ¶
NewPatchResourceError creates an error for resource patching failures
func NewReconcileError ¶
NewReconcileError creates an error for reconciliation failures
func NewTimeoutError ¶
NewTimeoutError creates an error for timeout failures
func NewUpdateResourceError ¶
NewUpdateResourceError creates an error for resource update failures
func NewValidationError ¶
NewValidationError creates an error for validation failures
func WrapErrorf ¶
WrapErrorf wraps an error with formatted context information
Types ¶
type ErrorHandler ¶
type ErrorHandler struct { Client client.Client Log logr.Logger EventRecorder record.EventRecorder }
ErrorHandler handles errors in the reconciliation loop
func NewErrorHandler ¶
func NewErrorHandler(client client.Client, log logr.Logger, recorder record.EventRecorder) *ErrorHandler
NewErrorHandler creates a new ErrorHandler
func (*ErrorHandler) HandleError ¶
func (eh *ErrorHandler) HandleError(ctx context.Context, err error, resource coh.CoherenceResource, msg string) (reconcile.Result, error)
HandleError handles an error in the reconciliation loop
func (*ErrorHandler) HandleResourceError ¶
func (eh *ErrorHandler) HandleResourceError(ctx context.Context, err error, resource coh.CoherenceResource, operation string, msg string) (reconcile.Result, error)
HandleResourceError handles an error related to a specific resource
func (*ErrorHandler) LogAndReturnError ¶
func (eh *ErrorHandler) LogAndReturnError(err error, msg string) error
LogAndReturnError logs the error and returns it
func (*ErrorHandler) LogAndWrapError ¶
func (eh *ErrorHandler) LogAndWrapError(err error, msg string) error
LogAndWrapError logs the error, wraps it with the message, and returns it
func (*ErrorHandler) LogAndWrapErrorf ¶
func (eh *ErrorHandler) LogAndWrapErrorf(err error, format string, args ...interface{}) error
LogAndWrapErrorf logs the error, wraps it with the formatted message, and returns it
func (*ErrorHandler) RetryOnError ¶
func (eh *ErrorHandler) RetryOnError(operation string, fn func() error) error
RetryOnError retries the given function with exponential backoff on error
func (*ErrorHandler) RetryWithContext ¶
func (eh *ErrorHandler) RetryWithContext(ctx context.Context, operation string, resource string, namespace string, fn func() error) error
RetryWithContext retries the given function with context and additional metadata
type OperationError ¶
type OperationError struct { Operation string Resource string Namespace string Err error Context map[string]string }
OperationError represents an error that occurred during an operation
func NewOperationError ¶
func NewOperationError(operation string, err error) *OperationError
NewOperationError creates a new OperationError
func NewResourceError ¶
func NewResourceError(operation string, resource string, namespace string, err error) *OperationError
NewResourceError creates a new OperationError for a specific resource
func (*OperationError) Cause ¶
func (e *OperationError) Cause() error
Cause returns the underlying error (for compatibility with github.com/pkg/errors)
func (*OperationError) Error ¶
func (e *OperationError) Error() string
Error returns the error message
func (*OperationError) Unwrap ¶
func (e *OperationError) Unwrap() error
Unwrap returns the underlying error
func (*OperationError) WithContext ¶
func (e *OperationError) WithContext(key, value string) *OperationError
WithContext adds context to the error