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

Detailed unmarshalling error information #360

Open
oioio opened this issue Mar 4, 2022 · 0 comments
Open

Detailed unmarshalling error information #360

oioio opened this issue Mar 4, 2022 · 0 comments

Comments

@oioio
Copy link

oioio commented Mar 4, 2022

Hi there.

I want to add more detailed information to unmarshalling errors, such as the struct instance and the name of the field where the error occurred. Would you be interested in such a PR?

How would be better to implement this?

  1. Pass additional info in Lexer methods, like out.Value = in.String(out, "Value")
  2. Add properties with current handling instance and field, to Lexer and set them before literals parsing, like
in.SetCurrent(out, "Value")
out.Value = in.String()
  1. Return error from parsing methods and wrap them with more detailed error, like
out.Value, err := string(in.String())
in.AddParseError(err, out, "Value")
  1. Something else?

I would prefer the third one.

@mailru mailru deleted a comment from misha456gggg Mar 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant