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

gestalt/get shouldn't throw an exception for false/nil values #1

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

Conversation

klparrot
Copy link

Previously gestalt/get returned the value it found or threw an IllegalArgumentException; the or means that if it found a falsey value, rather than returning that value, it threw. This is changed to have it return whatever it finds, and only throw when the requested keys doesn't exist in the configuration.

gestalt/contains? already sort of had that behaviour, except that it only supported a single key, rather than a sequence of keys like you could pass to gestalt/get. This is changed so that you can pass the same arguments to gestalt/contains? as to gestalt/get.

Now, for keys &ks, if (apply gestalt/contains? ks) is true, (apply gestalt/get ks) will return a value, and if (apply gestalt/contains? ks) is false, (apply gestalt/get ks) will throw.

src/montoux/gestalt.clj Outdated Show resolved Hide resolved
test/test/montoux/gestalt.clj Show resolved Hide resolved
@sfnelson
Copy link

Nice change!

@montoux montoux deleted a comment from sfnelson Sep 3, 2019
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

3 participants