Skip to content

Commit

Permalink
Rename scopeFailures to scopeFailure
Browse files Browse the repository at this point in the history
  • Loading branch information
ruippeixotog committed Nov 19, 2017
1 parent aeaafcd commit ace155f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/src/main/scala/pureconfig/ConfigConvert.scala
Expand Up @@ -28,7 +28,7 @@ trait ConfigConvert[A] extends ConfigReader[A] with ConfigWriter[A] { outer =>
* respectively.
*/
def xmap[B](f: A => B, g: B => A): ConfigConvert[B] = new ConfigConvert[B] {
def from(cur: ConfigCursor) = outer.from(cur).right.flatMap { v => cur.scopeFailures(toResult(f)(v)) }
def from(cur: ConfigCursor) = outer.from(cur).right.flatMap { v => cur.scopeFailure(toResult(f)(v)) }
def to(a: B) = outer.to(g(a))
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/pureconfig/ConfigCursor.scala
Expand Up @@ -147,7 +147,7 @@ sealed trait ConfigCursor {
* @tparam A the returning type of the `ConfigReader`
* @return a `ConfigReader` result built by scoping `reason` into the context of this cursor.
*/
def scopeFailures[A](result: Either[FailureReason, A]): Either[ConfigReaderFailures, A] =
def scopeFailure[A](result: Either[FailureReason, A]): Either[ConfigReaderFailures, A] =
result.left.map { reason => ConfigReaderFailures(failureFor(reason), Nil) }

private[this] def castOrFail[A](expectedType: ConfigValueType, cast: ConfigValue => A): Either[ConfigReaderFailures, A] = {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/pureconfig/ConfigReader.scala
Expand Up @@ -40,7 +40,7 @@ trait ConfigReader[A] {
* @return a `ConfigReader` returning the results of this reader mapped by `f`.
*/
def map[B](f: A => B): ConfigReader[B] =
fromCursor[B] { cur => from(cur).right.flatMap { v => cur.scopeFailures(toResult(f)(v)) } }
fromCursor[B] { cur => from(cur).right.flatMap { v => cur.scopeFailure(toResult(f)(v)) } }

/**
* Maps a function that can possibly fail over the results of this reader.
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/pureconfig/ConvertHelpers.scala
Expand Up @@ -34,7 +34,7 @@ trait ConvertHelpers {
// Because we can't trust Typesafe Config not to throw, we wrap the
// evaluation into a `try-catch` to prevent an unintentional exception from escaping.
try {
cur.scopeFailures {
cur.scopeFailure {
fromF(cur.asString.fold(_ => cur.value.render(ConfigRenderOptions.concise), identity))
}
} catch {
Expand Down
Expand Up @@ -68,7 +68,7 @@ class ProductConvertersSuite extends BaseSuite {
def from(cur: ConfigCursor) =
if (cur.isUndefined) Right(42) else {
val s = cur.value.render(ConfigRenderOptions.concise)
cur.scopeFailures(catchReadError(_.toInt)(implicitly)(s))
cur.scopeFailure(catchReadError(_.toInt)(implicitly)(s))
}
def to(v: Int) = ???
}
Expand Down

0 comments on commit ace155f

Please sign in to comment.