This commit is contained in:
2025-09-29 15:28:09 +08:00
parent 03941068d8
commit 715033f650
5 changed files with 141 additions and 124 deletions
+20 -2
View File
@@ -1,9 +1,27 @@
package copier
import "errors"
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")
ErrNotSupported = errors.New("not supported")
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}
}