Package 

Class ResultUtilsKt

    • Method Summary

      Modifier and Type Method Description
      final static <T extends Any> Result<T> runSafely(Function0<T> block) Runs a block of code and returns a Result containing the outcome.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.