on

inline fun <T> on(body: () -> T): Try<T>

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

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