data class Failure<out A> : Try<A>
Failure(exception: Throwable) |
val exception: Throwable |
|
val isFailure: Boolean
|
|
val isSuccess: Boolean
|
fun getOrThrow(): A
Returns the value if a Success otherwise throws the exception if a Failure. |
|
fun toString(): String |
fun <B, C> combine(other: Try<B>, function: (A, B) -> C): Try<C>
Maps the given function to the values from this Success and other, or returns |
|
fun doOnFailure(action: Consumer<Throwable>): Try<A>
Applies the given action to the error if Failure, or does nothing if Success. Returns |
|
fun doOnSuccess(action: Consumer<in A>): Try<A>
Applies the given action to the value if Success, or does nothing if Failure. Returns |
|
fun <B> flatMap(function: (A) -> Try<B>): Try<B>
Returns the given function applied to the value from this Success, or returns |
|
fun <B> map(function: (A) -> B): Try<B>
Maps the given function to the value from this Success, or returns |
|
fun throwError(): Try<A>
If this is a Failure wrapping an Error then throw it, otherwise return |