diff --git a/src/commonMain/kotlin/at/asitplus/KmmResult.kt b/src/commonMain/kotlin/at/asitplus/KmmResult.kt index 71861bd..d050a3f 100644 --- a/src/commonMain/kotlin/at/asitplus/KmmResult.kt +++ b/src/commonMain/kotlin/at/asitplus/KmmResult.kt @@ -206,7 +206,8 @@ private constructor( * Re-throws any fatal exceptions, such as `OutOfMemoryError`. Relies on [Arrow](https://arrow-kt.io)'s * [nonFatalOrThrow](https://apidocs.arrow-kt.io/arrow-core/arrow.core/non-fatal-or-throw.html) internally. */ -inline fun catching(block: () -> T): KmmResult { +@Suppress("TooGenericExceptionCaught") +inline fun catching(block: () -> T): KmmResult { return try { KmmResult.success(block()) } catch (e: Throwable) { @@ -220,10 +221,11 @@ inline fun catching(block: () -> T): KmmResult { * Re-throws any fatal exceptions, such as `OutOfMemoryError`. Relies on [Arrow](https://arrow-kt.io)'s * [nonFatalOrThrow](https://apidocs.arrow-kt.io/arrow-core/arrow.core/non-fatal-or-throw.html) internally. */ -inline fun T.catching(block: T.() -> R): KmmResult { +@Suppress("TooGenericExceptionCaught") +inline fun T.catching(block: T.() -> R): KmmResult { return try { KmmResult.success(block()) } catch (e: Throwable) { KmmResult.failure(e) } -} \ No newline at end of file +}