copier icon indicating copy to clipboard operation
copier copied to clipboard

errors in copier.TypeConverters are not returned from the CopyWithOption function and values with error are not applied

Open valantonini opened this issue 2 years ago • 2 comments

Reproducible Example

https://go.dev/play/p/lrlMEMSFKZ_N

Description

If an error is returned in a copier.TypeConverter, the copier.CopyWithOption returns nil for the error and the value is not applied to the destination.

In the Go Playground example above, the custom converter returns an error as well as the value "invalid".

I would expect copier.CopyWithOption to return the error and for dest.Val to be "invalid".

We are happy to work on the fix if this is indeed an issue.

valantonini avatar Jul 18 '22 07:07 valantonini

fixed. let error will raise up if the error is happening.

XiXiangFiles avatar Sep 16 '22 03:09 XiXiangFiles

If I understand correctly you are aiming at returning an error message if the source and destinations types are not a match and not convertible?

uded avatar Jan 06 '23 12:01 uded