-
Notifications
You must be signed in to change notification settings - Fork 9
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
Print a warning when config cannot be found #35
base: master
Are you sure you want to change the base?
Conversation
I think as long as we're covering all the bases it should be fine. A config can be required (or not) and have a default (or not). It is totally conceivable to have an application that specifies defaults for all its configs and it is normal that there is no A required config should cause the application to fail to start, if a value cannot be found for it. I think it is helpful in that circumstance to distinguish between "a config value could not be found" and "LOL there's not even a config file". I guess that's all I have to say about it. :) |
Oh snap; source info is a great idea! :) +1 |
I’ll be adding tests for the changes soon. Been a bit busy! |
Apologies for the long pause. I added a test for |
This modest patch presents a warning to the user whenever configuration cannot be found in the expected locations. The motivation for this stems from being frustrated by
and the subsequent giant pile of stack trace when the file is missing. In general, I think I would prefer a much better error message when config value is missing i.e. it couldn't be found because the configuration source was missing vs. it couldn't be found because it wasn't specified in the source. These are distinct situations and warrant distinct messages.
I think this could easily be improved by having
load-config
annotate the return value of(read-config source)
with meta indicating it's source and subsequently providing a helper function to access that information. These additions would be enough to produce a better error message indefconfig
.I'm happy to revise and submit these proposals as a proper patch provided the reception is positive. The changes are safe, simple and would not result in breakage.