EitherObjectOps
class AnyVal
trait Matchable
class Any
Value members
Concrete methods
Evaluates the specified block, catching exceptions of the specified type and returning them on the left side of
the resulting Either
. Uncaught exceptions are propagated.
Evaluates the specified block, catching exceptions of the specified type and returning them on the left side of
the resulting Either
. Uncaught exceptions are propagated.
For example:
scala> import cats.implicits._ // get syntax for Either
scala> Either.catchOnly[NumberFormatException] { "foo".toInt }
res0: Either[NumberFormatException, Int] = Left(java.lang.NumberFormatException: For input string: "foo")
Converts an Option[B]
to an Either[A, B]
, where the provided ifNone
values is returned on
the left of the Either
when the specified Option
is None
.
Converts an Option[B]
to an Either[A, B]
, where the provided ifNone
values is returned on
the left of the Either
when the specified Option
is None
.