Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
valantonini opened this issue Jul 18, 2022 · 2 comments
Assignees
Milestone

Comments

@valantonini
Copy link

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.

XiXiangFiles pushed a commit to XiXiangFiles/copier that referenced this issue Sep 15, 2022
XiXiangFiles pushed a commit to XiXiangFiles/copier that referenced this issue Sep 15, 2022
@XiXiangFiles
Copy link

XiXiangFiles commented Sep 16, 2022

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

XiXiangFiles pushed a commit to XiXiangFiles/copier that referenced this issue Sep 20, 2022
@uded
Copy link
Collaborator

uded commented Jan 6, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants