exceptionOrNull

Returns the encapsulated Throwable exception if this instance represents failure or null if it is success.

This function is a shorthand for fold(onSuccess = { null }, onFailure = { it }) (see fold).

Since Kotlin

1.3