Evaluates the specified block, catching exceptions of the specified type and returning them on the left side of
the resulting Xor
.
Evaluates the specified block, catching exceptions of the specified type and returning them on the left side of
the resulting Xor
. Uncaught exceptions are propagated.
For example:
scala> Xor.catchOnly[NumberFormatException] { "foo".toInt } res0: Xor[NumberFormatException, Int] = Left(java.lang.NumberFormatException: For input string: "foo")
Converts an Either[A, B]
to an A Xor B
.
Converts an Either[A, B]
to an A Xor B
.
Converts an Option[B]
to an A Xor B
, where the provided ifNone
values is returned on
the left of the Xor
when the specified Option
is None
.
Converts an Option[B]
to an A Xor B
, where the provided ifNone
values is returned on
the left of the Xor
when the specified Option
is None
.
Converts a Try[A]
to a Throwable Xor A
.
Converts a Try[A]
to a Throwable Xor A
.