-
public final class ResultUtilsKt
-
-
Method Summary
-
-
Method Detail
-
runSafely
final static <T extends Any> Result<T> runSafely(Function0<T> block)
Runs a block of code and returns a Result containing the outcome.
If the block completes successfully, the result is a success with the value returned by the block. If an exception is thrown, it is caught and wrapped in a failure result. Cancellation exceptions are rethrown to allow coroutine cancellation to propagate.
- Parameters:
block- The block of code to execute.
-
-
-
-