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

Refactor error messages for missing variables. #117

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rasulov-emirlan
Copy link

Before we would return error right aways. Now when we encounter an error on parsing stage, we try to list all the missing or incorrect envs. This should make debugging for our users easier. Seeing all the missing and incorrect envs, will help us fix configs faster. Also added some tests for the new error type.

Here is an example of what error message might look like:

missing required environment variables: 
	"PORT"
	"JWT_SALT"
	"READ_TIMEOUT"
parsing errors for environment variables: 
	field WriteTimeout env "WRITE_TIMEOUT": time: invalid duration "incorrect"

We might even make the error type public in the future. So our users will have an ability to choose how the want to represent these errors.

PS: thank you for this amazing package

Before we would return error right aways. Now when we encounter an error on parsing stage, we try to list all the missing or incorrect envs. This should make debugging for our users easier
Also added some tests for the new error type.
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

Successfully merging this pull request may close these issues.

None yet

1 participant