tryCatch
fun <T, U, E : Throwable> T.tryCatch(catchOn: KClass<E>, body: (T) -> U): U?
Content copied to clipboard
Tries a function method on T, returns null
if the exception was the instance of E.
Return
The result from the body function as U.
Parameters
catchOn
The exception to catch on.
body
The body function to call.