Try.Companion
Keywords: net.corda.core.utilities.Try.Companion class
Date: 2023-09-18

net.corda.core.utilities

## Class Try.Companion

- net.corda.core.utilities.Try.Companion

- Enclosing class:
    Try<A>

      public static class Try.Companion

- - ### Method Detail

    - #### on

          @JvmStatic
           @NotNull
          public <T> Try<T> on(@NotNull
                                                    kotlin.jvm.functions.Function0<? extends T> body)

      Executes the given block of code and returns a `class Try.Success` capturing the result, or a `class Try.Failure` if a Throwable is thrown.

      It is recommended this be chained with `throwError` to ensure critial Errors are thrown and not captured.

      See Also:
        `class Try.Success`, `class Try.Failure`, Throwable, `throwError`, Error