sdk-common / com.tomtom.online.sdk.common.functional / Try / recover

recover

abstract fun recover(@NonNull function: (in Throwable!) -> out T): Try<T>!

Applies the given function if this is a Failure, otherwise returns a Success if this is a Success. This is like a Try#map(Function1) for an exception.

Parameters

function - (in Throwable!) -> out T: Function that will be used to recover from the exception if this is a Failure.

Return
Try<T>!: instance of Success if the recovery was successful, a Failure otherwise.