Pureconfig errors are misleading in the face of ConfigConverts missing.
See original GitHub issueToday if you have nested configs like the following
case class Foo(bar: Bar)
case class Bar(nel: NonEmptyList[String])
When you try and load a config for Foo
you get an error like this:
could not find implicit value for parameter conv: pureconfig.ConfigConvert[Foo]
when in reality, it’s Bar that’s the problem.
Do you have any ideas about how we could improve the error? One thought I had was to add a “semi automatic” derivation mode where we could create a ConfigConvert
on the companion object of each of the nested objects.
Like this:
case class Bar(nel: NonEmptyList[String])
object Bar {
implicit val configConvert = pureconfig.derive[Bar]
}
case class Foo(bar:Bar)
object Foo{
implicit val configConvert = pureconfig.derive[Foo]
}
Obviously this changes the way that pureconfig works and we’d have to have 2 different imports, one for “full auto” and one for “semi auto” derivation.
@melrief, Would you be interested in a change like this? Do you see another way around the terrible error messages?
Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top Results From Across the Web
melrief/pureconfig - Gitter
That has the downside that it will load both files if both are present and that it won't report an error about a...
Read more >Read Pure functional HTTP APIs in Scala | Leanpub
First we test with garbage JSON in the request. Before doing the request we actually create a product to avoid getting an error...
Read more >pureconfig.error.ConfigReaderFailures Scala Example
This page shows Scala examples of pureconfig.error.ConfigReaderFailures. ... ConfigConvert, ConfigReader, ConfigWriter } import pureconfig.error.
Read more >Config Writers - PureConfig
A ConfigConvert implements both the ConfigReader and ConfigWriter interfaces and can be used everywhere one of them is needed.
Read more >PureConfig - Giter VIP
Scala 99.49% Shell 0.51% pureconfig scala-library configuration shapeless scala ... Pureconfig errors are misleading in the face of ConfigConverts missing.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closed by #279.
@francisdb thanks for the links, I’ll have a look at the code. I think we could change the codec generator from the one that we have shapeless based to a custom macro based one. I’m not happy to have my own macro but if it makes much cleaner the error messages then I’m for trying it. I’ll talk with the other two authors and see how we want to proceed.