Documentation
¶
Overview ¶
Package errors provides standardized error types for DataFrame operations. This package defines DataFrameError for consistent error handling across all public APIs, with operation context and error wrapping support.
Index ¶
- Variables
- type DataFrameError
- func NewColumnNotFoundError(op, column string) *DataFrameError
- func NewColumnNotFoundErrorWithSuggestions(op, column string, availableColumns []string) *DataFrameError
- func NewIndexOutOfBoundsError(op string, index, maxIndex int) *DataFrameError
- func NewInternalError(op string, cause error) *DataFrameError
- func NewInvalidInputError(op, message string) *DataFrameError
- func NewTypeMismatchError(op, column, expectedType, actualType string) *DataFrameError
- func NewUnsupportedTypeError(op, typeName string) *DataFrameError
- func NewValidationError(op, column, message string) *DataFrameError
- func (e *DataFrameError) Error() string
- func (e *DataFrameError) Format(level ErrorLevel) string
- func (e *DataFrameError) Is(target error) bool
- func (e *DataFrameError) Unwrap() error
- func (e *DataFrameError) WithCause(cause error) *DataFrameError
- func (e *DataFrameError) WithContext(context map[string]string) *DataFrameError
- func (e *DataFrameError) WithDataFrameInfo(info DataFrameInfo) *DataFrameError
- func (e *DataFrameError) WithHint(hint string) *DataFrameError
- type DataFrameInfo
- type ErrorLevel
- type OperationContext
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmptyDataFrame indicates operations on empty DataFrames ErrEmptyDataFrame = &DataFrameError{ Op: "validation", Message: "operation not supported on empty DataFrame", } // ErrMismatchedLength indicates length mismatches in operations ErrMismatchedLength = &DataFrameError{ Op: "validation", Message: "arrays must have the same length", } // ErrInvalidIndex indicates out-of-bounds index access ErrInvalidIndex = &DataFrameError{ Op: "indexing", Message: "index out of bounds", } )
Predefined error variables for common cases
Functions ¶
This section is empty.
Types ¶
type DataFrameError ¶
type DataFrameError struct {
Op string // Operation name (e.g., "Sort", "Filter", "Join")
Column string // Column name if applicable
Message string // Human-readable error description
Cause error // Underlying error cause
Hint string // Suggested solution or helpful tip
Context map[string]string // Additional context information
DataInfo *DataFrameInfo // DataFrame information for better context
}
DataFrameError represents standardized errors across all DataFrame operations
func NewColumnNotFoundError ¶
func NewColumnNotFoundError(op, column string) *DataFrameError
NewColumnNotFoundError creates an error for operations on non-existent columns
func NewColumnNotFoundErrorWithSuggestions ¶
func NewColumnNotFoundErrorWithSuggestions(op, column string, availableColumns []string) *DataFrameError
NewColumnNotFoundErrorWithSuggestions creates a column not found error with similar column suggestions
func NewIndexOutOfBoundsError ¶
func NewIndexOutOfBoundsError(op string, index, maxIndex int) *DataFrameError
NewIndexOutOfBoundsError creates an error for out-of-bounds index access
func NewInternalError ¶
func NewInternalError(op string, cause error) *DataFrameError
NewInternalError creates an error for internal operation failures
func NewInvalidInputError ¶
func NewInvalidInputError(op, message string) *DataFrameError
NewInvalidInputError creates an error for invalid operation inputs
func NewTypeMismatchError ¶
func NewTypeMismatchError(op, column, expectedType, actualType string) *DataFrameError
NewTypeMismatchError creates an error for type mismatches
func NewUnsupportedTypeError ¶
func NewUnsupportedTypeError(op, typeName string) *DataFrameError
NewUnsupportedTypeError creates an error for unsupported data types
func NewValidationError ¶
func NewValidationError(op, column, message string) *DataFrameError
NewValidationError creates an error for input validation failures
func (*DataFrameError) Error ¶
func (e *DataFrameError) Error() string
Error implements the error interface
func (*DataFrameError) Format ¶
func (e *DataFrameError) Format(level ErrorLevel) string
Format returns a formatted error message at the specified verbosity level
func (*DataFrameError) Is ¶
func (e *DataFrameError) Is(target error) bool
Is implements error equality checking for errors.Is()
func (*DataFrameError) Unwrap ¶
func (e *DataFrameError) Unwrap() error
Unwrap returns the underlying cause for error wrapping support
func (*DataFrameError) WithCause ¶
func (e *DataFrameError) WithCause(cause error) *DataFrameError
WithCause adds an underlying cause to the error
func (*DataFrameError) WithContext ¶
func (e *DataFrameError) WithContext(context map[string]string) *DataFrameError
WithContext adds additional context information to the error
func (*DataFrameError) WithDataFrameInfo ¶
func (e *DataFrameError) WithDataFrameInfo(info DataFrameInfo) *DataFrameError
WithDataFrameInfo adds DataFrame information for better context
func (*DataFrameError) WithHint ¶
func (e *DataFrameError) WithHint(hint string) *DataFrameError
WithHint adds a helpful hint to the error
type DataFrameInfo ¶
type DataFrameInfo struct {
Rows int // Number of rows
Columns []string // Column names
Types map[string]string // Column name to type mapping
}
DataFrameInfo contains information about a DataFrame for error context
type ErrorLevel ¶
type ErrorLevel int
ErrorLevel defines the verbosity level for error formatting
const ( ErrorLevelSimple ErrorLevel = iota ErrorLevelDetailed ErrorLevelDebug )
type OperationContext ¶
type OperationContext struct {
Operation string // High-level operation name
Step int // Current step number
TotalSteps int // Total number of steps
DataInfo DataFrameInfo // Information about the DataFrame being processed
}
OperationContext provides context for wrapping errors in multi-step operations
func (*OperationContext) WrapError ¶
func (ctx *OperationContext) WrapError(err error) *DataFrameError
WrapError wraps an error with operation context information