gferrors

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package gferrors provides common error types and utilities for the goflow library.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrClosed indicates that an operation was attempted on a closed resource
	ErrClosed = errors.New("resource is closed")

	// ErrTimeout indicates that an operation timed out
	ErrTimeout = errors.New("operation timed out")

	// ErrCapacityExceeded indicates that a capacity limit was exceeded
	ErrCapacityExceeded = errors.New("capacity exceeded")

	// ErrInvalidConfiguration indicates invalid configuration parameters
	ErrInvalidConfiguration = errors.New("invalid configuration")

	// ErrRateLimited indicates that a request was rate limited
	ErrRateLimited = errors.New("rate limited")
)

Functions

func IsRetryable

func IsRetryable(err error) bool

IsRetryable returns true if the error indicates a condition that might be resolved by retrying the operation

func IsTemporary

func IsTemporary(err error) bool

IsTemporary returns true if the error indicates a temporary condition

func IsValidationError

func IsValidationError(err error) bool

IsValidationError returns true if the error is a validation error

Types

type OperationError

type OperationError struct {
	Module    string // The module where the error occurred
	Operation string // The operation that failed
	Cause     error  // The underlying error
	Context   string // Additional context about the failure
}

OperationError represents an error during library operation with context

func NewOperationError

func NewOperationError(module, operation string, cause error) *OperationError

NewOperationError creates a new operation error with context

func (*OperationError) Error

func (e *OperationError) Error() string

func (*OperationError) Unwrap

func (e *OperationError) Unwrap() error

func (*OperationError) WithContext

func (e *OperationError) WithContext(context string) *OperationError

WithContext adds additional context to an operation error

type ValidationError

type ValidationError struct {
	Module string      // The module where the error occurred
	Field  string      // The configuration field that's invalid
	Value  interface{} // The invalid value provided
	Reason string      // Why the value is invalid
	Hint   string      // Suggestion for fixing the issue
}

ValidationError represents a configuration validation error with actionable details

func NewValidationError

func NewValidationError(module, field string, value interface{}, reason string) *ValidationError

NewValidationError creates a new validation error with helpful details

func (*ValidationError) Error

func (e *ValidationError) Error() string

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

func (*ValidationError) WithHint

func (e *ValidationError) WithHint(hint string) *ValidationError

WithHint adds a helpful suggestion to a validation error

Jump to

Keyboard shortcuts

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