catching

inline fun <T> catching(block: () -> T): KmmResult<T>(source)

Non-fatal-only-catching version of stdlib's runCatching, directly returning a KmmResult -- Re-throws any fatal exceptions, such as OutOfMemoryError. Re-implements Arrow's nonFatalOrThrow logic to avoid a dependency on Arrow for a single function.


inline fun <T, R> R.catching(block: R.() -> T): KmmResult<T>(source)

See also