-
Notifications
You must be signed in to change notification settings - Fork 4
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
Support returning multiple errors when parsing env #3
Conversation
@@ -50,20 +50,28 @@ type VariableFlipped ty name = Variable name ty | |||
infixr 5 type VariableFlipped as <: | |||
|
|||
-- | An error that can occur while reading an environment variable | |||
data EnvError = EnvLookupError String | EnvParseError String | |||
data EnvError = EnvLookupError String | EnvParseError String | EnvErrors (Array EnvError) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very useful feature!
but why not just change the parser return type to from EnvError
to Array EnvError
without changing EnvError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion, @srghma. I'm going to merge this change as-is but will follow up with your recommendation.
When I'm starting up my app with environment variables I'd prefer to know all the variable parsing errors at once (as opposed to fixing one -> restarting the app -> finding out the next error and fixing that one etc..).
This PR updates the EnvError type to support accumulating multiple errors.