Closed kwrooijen closed 4 years ago
@weavejester How is this?
@weavejester ping
Sorry about the delay - I've been trying to get through my backlog of PRs and issues.
This looks fine, but could you add a small test in in order to prevent any regressions?
I appreciate this getting some love, thanks kwrooijen and weavejester! :pray: :heart:
@teodorlu Thank you for the reminder @weavejester added some tests
@weavejester applied your requested changes / responded
Problem
Currently when adding an init-key outside of
:duct.profile/base
, which is not a function (takes a config, returns a config), you get the following error.This is not very helpful, because the end user will most likely assume that they made a typo in their config. I also believe new users struggle with understanding the difference between regular init-key and module init-keys. Which is why they put keys in the wrong place.
Solution
Add validation to the
fold-modules
function, checking that each module key is anfn
. If not, throw a custom error which is more understandable than the default.Notes
I'm sure the exception message / docstring can be improved on. Also, should a private function have a docstring?