• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pureconfig / pureconfig / 16844894943

09 Aug 2025 03:28AM UTC coverage: 94.686% (-0.04%) from 94.726%
16844894943

Pull #1838

web-flow
Merge 12f0062cf into 38f73c635
Pull Request #1838: Rid of deprecated URL constructor

1 of 1 new or added line in 1 file covered. (100.0%)

95 existing lines in 26 files now uncovered.

2744 of 2898 relevant lines covered (94.69%)

2.43 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.82
/core/src/main/scala/pureconfig/backend/ErrorUtil.scala
1
package pureconfig.backend
2

3
import scala.util.control.NonFatal
4

5
import com.typesafe.config._
6

7
import pureconfig._
8
import pureconfig.error._
9

10
/** Contains common utilities to deal with exceptions in unsafe methods.
11
  */
12
object ErrorUtil {
13

14
  def unsafeToReaderResult[A](
1✔
15
      f: => A,
16
      onIOFailure: Option[Option[Throwable] => CannotRead] = None
17
  ): ConfigReader.Result[A] = {
18
    try Right(f)
4✔
19
    catch {
20
      case e: ConfigException.IO if onIOFailure.nonEmpty =>
2✔
21
        ConfigReader.Result.fail(onIOFailure.get(Option(e.getCause)))
2✔
22

23
      case e: ConfigException.Parse =>
2✔
24
        val msg = (if (e.origin != null)
1✔
25
                     // Removing the error origin from the exception message since origin is stored and used separately:
26
                     e.getMessage.stripPrefix(s"${e.origin.description}: ")
1✔
27
                   else
UNCOV
28
                     e.getMessage).stripSuffix(".")
1✔
29
        ConfigReader.Result.fail(CannotParse(msg, Some(e.origin())))
2✔
30

UNCOV
31
      case e: ConfigException =>
32
        ConfigReader.Result.fail(ThrowableFailure(e, Some(e.origin())))
×
33

UNCOV
34
      case NonFatal(e) =>
35
        ConfigReader.Result.fail(ThrowableFailure(e, None))
×
36
    }
37
  }
38
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc