duct-framework / core

The core library of the Duct framework
76 stars 21 forks source link

Invalid format of the config - User friendly message #13

Open LukasRychtecky opened 6 years ago

LukasRychtecky commented 6 years ago

Hi,

I've noticed that when config.edn is in invalid format (e.g. "Map literal must contain an even number of forms") in a stack trace you will see something like java.lang.RuntimeException: Map literal must contain an even number of forms, compiling:(dev.clj:41:11) after calling (dev) in REPL. It points into dev.clj which is confusing. What do you think about to wrap read-config in https://github.com/duct-framework/core/blob/master/src/duct/core.clj#L123 into try-catch and raise an exception within a message like: "Tip: Check you configuration in resources/fooproject/config.edn for format errors"?

weavejester commented 6 years ago

This is a good idea, but let's do it in a way that doesn't hide information from the developer either.