We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
tryOrNull()
1 parent 784b84d commit 2a59e6aCopy full SHA for 2a59e6a
libraries/core/src/main/kotlin/io/element/android/libraries/core/data/Try.kt
@@ -16,11 +16,11 @@
16
17
package io.element.android.libraries.core.data
18
19
-inline fun <A> tryOrNull(noinline onError: ((Throwable) -> Unit)? = null, operation: () -> A): A? {
+inline fun <A> tryOrNull(onError: ((Throwable) -> Unit) = { }, operation: () -> A): A? {
20
return try {
21
operation()
22
} catch (any: Throwable) {
23
- onError?.invoke(any)
+ onError.invoke(any)
24
null
25
}
26
0 commit comments