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

config should tell give more context when it fails to parse a field, error should include the type #41

Open
ankittk opened this issue May 3, 2023 · 0 comments

Comments

@ankittk
Copy link
Contributor

ankittk commented May 3, 2023

Hello,

While using go-config, We realized that the error parsing is missing data, what field is giving error if we have tons of config declared in config.go file? If you have a different field and that field fails to parse you get the nested error from same but you have no idea which field in your struct is the one that is failing. This leads to a lot of guessing and lost time.

Example:

RequiredConfig2 int32 `required:"true" env:"REQUIRED_CONFIG_2"`

Error getting:

error loading config | strconv.ParseInt: parsing "test": invalid syntax
main.main.func1()

The error should have mentioned

error loading config | strconv.ParseInt: parsing "test": invalid syntax
main.main.func1() | type=["mystruct"] field="RequiredConfig2"
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