question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pureconfig errors are misleading in the face of ConfigConverts missing.

See original GitHub issue

Today 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:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ruippeixotogcommented, Aug 16, 2017

Closed by #279.

1reaction
melriefcommented, Nov 11, 2016

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found