Evaluates the specified block, catching exceptions of the specified type and returning them on the left side of
the resulting Either
.
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 a Try[A]
to a Either[Throwable, A]
.