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

Return error with Key info for required fields #151

Open
ghost opened this issue Aug 30, 2019 · 0 comments
Open

Return error with Key info for required fields #151

ghost opened this issue Aug 30, 2019 · 0 comments

Comments

@ghost
Copy link

ghost commented Aug 30, 2019

In the Process method, if there is a problem with processing a specific config the method returns a ParseError object. Which includes information such as which key is the problem.

I would like to have a similar granularity of information if a required field is missing.
https://github.com/kelseyhightower/envconfig/blob/master/envconfig.go#L210

Perhaps using ParseError makes sense, or a new error type that carries just the key and message.
This is useful both from testing as a client and for advanced reporting.
I am trying to test that a certain key is required, and I want to validate that it is the key in question that causes the error.
And if we have a require environment variable that is missing in one of our services, we want to be able to call it out specifically in our operational output, rather than having to parse the string or dump it to the log.

Apologies, I would create a PR, but my office is strict against OSS contributions 😞

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

0 participants