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

getOrElseThrow

open fun <E : Throwable!> getOrElseThrow(): T

Returns Success value or in case of Failure throws exception that is stored in the Failure.

Exceptions

E - exception thrown if the method is invoked on Failure.

Return
T: value stored in the Success

open fun <E : Throwable!> getOrElseThrow(@NonNull provider: (in Throwable!) -> E): T

Returns Success value or in case of Failure throws exception that can be built by the given function from the throwable stored in the Failure.

Parameters

provider - (in Throwable!) -> E: function for converting Exception stored in Failure into the desired exception type.

- type of the exception that should be thrown if Failure.

Exceptions

E - exception thrown if the method is invoked on Failure

Return
T: value stored in the Success