exceptionOrElse

inline fun <T> KotlinResult<T>.exceptionOrElse(onSuccess: (value: T) -> Throwable): Throwable

Returns the encapsulated Throwable if failure, or the result of onSuccess applied to the encapsulated value if success.

Any exception thrown by onSuccess is rethrown directly.

See also