Documentation
¶
Overview ¶
Package errors provides type-safe error handling for dupl
Index ¶
- func HandleMarshalingError(operation, context string, err error) error
- func Is(err error, errorType ErrorType) bool
- func SafeMarshal(v any, context string) ([]byte, error)
- func SafeMarshalIndent(v any, prefix, indent, context string) ([]byte, error)
- func SafeUnmarshal(data []byte, v any, context string) error
- type DuplError
- func NewConfigError(msg string, cause error) *DuplError
- func NewIOError(file, msg string, cause error) *DuplError
- func NewInternalError(msg string, cause error) *DuplError
- func NewParseError(file string, line int, msg string, cause error) *DuplError
- func NewValidationError(msg string, cause error) *DuplError
- type EnumValidationError
- type ErrorType
- type MarshalError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleMarshalingError ¶
HandleMarshalingError provides unified JSON marshaling error handling.
func SafeMarshal ¶
SafeMarshal provides safe marshaling with consistent error handling.
func SafeMarshalIndent ¶
SafeMarshalIndent provides safe indented marshaling with consistent error handling.
Types ¶
type DuplError ¶
type DuplError struct {
Type ErrorType
Message string
File string
Line int
Cause error
Stack string
}
DuplError is the main error type with rich context.
func NewConfigError ¶
NewConfigError creates a new configuration error.
func NewIOError ¶
NewIOError creates a new I/O error.
func NewInternalError ¶
NewInternalError creates a new internal error.
func NewParseError ¶
NewParseError creates a new parse error with context.
func NewValidationError ¶
NewValidationError creates a new validation error.
type EnumValidationError ¶
EnumValidationError provides domain-specific error context for enum validation failures.
func NewEnumValidationError ¶
func NewEnumValidationError(enumType, enumValue string, cause error) *EnumValidationError
NewEnumValidationError creates a new enum validation error with rich context.
func (*EnumValidationError) Error ¶
func (e *EnumValidationError) Error() string
Error implements the error interface for EnumValidationError.
type MarshalError ¶
MarshalError is a specialized error for JSON marshaling failures.
func (*MarshalError) Error ¶
func (e *MarshalError) Error() string
func (*MarshalError) Unwrap ¶
func (e *MarshalError) Unwrap() error