wrappers

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRetryableError

func IsRetryableError(err error) bool

IsRetryableError checks if an error is a retryable error

func OperationError

func OperationError(err error, operation string, format string, args ...interface{}) error

OperationError wraps an error with operation-specific context

func OperationInternal

func OperationInternal(operation string, err error, format string, args ...interface{}) error

OperationInternal creates an internal error for an operation

func OperationInvalidInput

func OperationInvalidInput(operation string, format string, args ...interface{}) error

OperationInvalidInput creates an invalid input error for an operation

func OperationNotFound

func OperationNotFound(operation string, resourceType string, id string) error

OperationNotFound creates a not found error for an operation

func WithDetails

func WithDetails(err error, details map[string]interface{}) error

WithDetails adds details to an error.

func WrapAsRetryable

func WrapAsRetryable(err error, attempts, maxAttempts int, retryAfter int64) error

WrapAsRetryable wraps an error as retryable

func WrapWithOperation

func WrapWithOperation(err error, operation string, format string, args ...interface{}) error

WrapWithOperation wraps an error with an operation name and message.

Types

type RetryableError

type RetryableError struct {
	Original    error
	Attempts    int
	MaxAttempts int
	RetryAfter  int64 // milliseconds
}

RetryableError wraps an error with retryable context. This error type is used to indicate that an error should be retried by external systems. It is different from RetryError in the infra package, which is used internally by the retry package to indicate that all retry attempts have been exhausted.

func NewRetryableError

func NewRetryableError(err error, attempts, maxAttempts int, retryAfter int64) *RetryableError

NewRetryableError creates a new retryable error

func (*RetryableError) Error

func (e *RetryableError) Error() string

Error returns the error message

func (*RetryableError) IsRetryable

func (e *RetryableError) IsRetryable() bool

IsRetryable returns true if the error is retryable

func (*RetryableError) Unwrap

func (e *RetryableError) Unwrap() error

Unwrap returns the original error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL