mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
Don't log tryOrNull errors unnecessarily
This commit is contained in:
@@ -20,11 +20,14 @@ package com.moez.QKSMS.util
|
||||
|
||||
import timber.log.Timber
|
||||
|
||||
fun <T> tryOrNull(body: () -> T?): T? {
|
||||
fun <T> tryOrNull(logOnError: Boolean = true, body: () -> T?): T? {
|
||||
return try {
|
||||
body()
|
||||
} catch (e: Exception) {
|
||||
Timber.w(e)
|
||||
if (logOnError) {
|
||||
Timber.w(e)
|
||||
}
|
||||
|
||||
null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user