Documentation
¶
Overview ¶
Package errors defines error types and utilities for DynamORM
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrItemNotFound is returned when an item is not found in the database ErrItemNotFound = errors.New("item not found") // ErrInvalidModel is returned when a model struct is invalid ErrInvalidModel = errors.New("invalid model") // ErrMissingPrimaryKey is returned when a model doesn't have a primary key ErrMissingPrimaryKey = errors.New("missing primary key") // ErrInvalidPrimaryKey is returned when a primary key value is invalid ErrInvalidPrimaryKey = errors.New("invalid primary key") // ErrConditionFailed is returned when a condition check fails ErrConditionFailed = errors.New("condition check failed") // ErrIndexNotFound is returned when a specified index doesn't exist ErrIndexNotFound = errors.New("index not found") // ErrTransactionFailed is returned when a transaction fails ErrTransactionFailed = errors.New("transaction failed") // ErrBatchOperationFailed is returned when a batch operation partially fails ErrBatchOperationFailed = errors.New("batch operation failed") // ErrUnsupportedType is returned when a field type is not supported ErrUnsupportedType = errors.New("unsupported type") // ErrInvalidTag is returned when a struct tag is invalid ErrInvalidTag = errors.New("invalid struct tag") // ErrTableNotFound is returned when a table doesn't exist ErrTableNotFound = errors.New("table not found") // ErrDuplicatePrimaryKey is returned when multiple primary keys are defined ErrDuplicatePrimaryKey = errors.New("duplicate primary key definition") // ErrEmptyValue is returned when a required value is empty ErrEmptyValue = errors.New("empty value") // ErrInvalidOperator is returned when an invalid query operator is used ErrInvalidOperator = errors.New("invalid query operator") // ErrEncryptionNotConfigured is returned when a model uses dynamorm:"encrypted" fields but no KMS key ARN is configured. ErrEncryptionNotConfigured = errors.New("encryption not configured") // ErrInvalidEncryptedEnvelope is returned when an encrypted attribute value is not a valid DynamORM envelope. ErrInvalidEncryptedEnvelope = errors.New("invalid encrypted envelope") // ErrEncryptedFieldNotQueryable is returned when a dynamorm:"encrypted" field is used in query/filter conditions. ErrEncryptedFieldNotQueryable = errors.New("encrypted fields are not queryable/filterable") )
Common errors that can occur in DynamORM operations
Functions ¶
func IsConditionFailed ¶
IsConditionFailed checks if an error indicates a condition check failure
func IsInvalidModel ¶
IsInvalidModel checks if an error indicates an invalid model
func IsNotFound ¶
IsNotFound checks if an error indicates an item was not found
Types ¶
type DynamORMError ¶
DynamORMError represents a detailed error with context
func NewError ¶
func NewError(op, model string, err error) *DynamORMError
NewError creates a new DynamORMError
func NewErrorWithContext ¶
func NewErrorWithContext(op, model string, err error, context map[string]any) *DynamORMError
NewErrorWithContext creates a new DynamORMError with context
func (*DynamORMError) Error ¶
func (e *DynamORMError) Error() string
Error implements the error interface
func (*DynamORMError) Is ¶
func (e *DynamORMError) Is(target error) bool
Is checks if the error matches the target error
func (*DynamORMError) Unwrap ¶
func (e *DynamORMError) Unwrap() error
Unwrap returns the underlying error
type EncryptedFieldError ¶
EncryptedFieldError wraps failures related to dynamorm:"encrypted" fields (encryption/decryption). It is safe-by-default: the error string must never include decrypted plaintext.
func (*EncryptedFieldError) Error ¶
func (e *EncryptedFieldError) Error() string
func (*EncryptedFieldError) Unwrap ¶
func (e *EncryptedFieldError) Unwrap() error
type TransactionError ¶ added in v1.0.37
type TransactionError struct {
Err error
Operation string
Model string
Reason string
OperationIndex int
}
TransactionError provides context for transactional failures.
func (*TransactionError) Error ¶ added in v1.0.37
func (e *TransactionError) Error() string
Error implements the error interface.
func (*TransactionError) Unwrap ¶ added in v1.0.37
func (e *TransactionError) Unwrap() error
Unwrap returns the underlying error.