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. Relies on Arrow's nonFatalOrThrow internally.


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

Non-fatal-only-catching version of stdlib's runCatching (calling the specified function block with this value as its receiver), directly returning a KmmResult -- Re-throws any fatal exceptions, such as OutOfMemoryError. Relies on Arrow's nonFatalOrThrow internally.