result Of
Context runner to encapsulate the result of block as a KotlinResult.
If block throws a non-fatal exception, the Throwable is encapsulated as a Result.failure.
If block throws a fatal exception, the Throwable is re-thrown!
For example, CancellationException, which is necessary for Kotlin's structured concurrency model, is considered fatal and will always be rethrown. Read more about issues with Kotlin's
runCatching()
Parameters
T
The return type of block.
block
The protected try-block which may throw and exception.
See also
non Fatal Or Throw
Throws
See Throwable.isFatal for list of unsafe exceptions.