Files
copier/errors.go
2025-09-29 15:28:09 +08:00

28 lines
714 B
Go

package copier
import (
"errors"
"fmt"
"reflect"
)
var (
ErrInvalidCopyDestination = errors.New("copy destination must be non-nil and addressable")
ErrInvalidCopyFrom = errors.New("copy from must be non-nil and addressable")
ErrCircularReference = errors.New("circular reference detected")
ErrMaxDepthExceeded = errors.New("max depth exceeded")
)
type NotSupportedError struct {
SrcType reflect.Type
DstType reflect.Type
}
func (e *NotSupportedError) Error() string {
return fmt.Sprintf("unsupported type conversion from %s to %s", e.SrcType, e.DstType)
}
func ErrNotSupported(srcType, dstType reflect.Type) error {
return &NotSupportedError{SrcType: srcType, DstType: dstType}
}