Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,6 @@ fun logError(throwable: Throwable) {
Log.d("ApiError", "-------------------------------------------------------------------")
}

@Deprecated(
"Outdated function, use `safe` instead",
replaceWith = ReplaceWith("safe"),
level = DeprecationLevel.ERROR
)
fun <T> normalSafeApiCall(apiCall: () -> T): T? {
return try {
apiCall.invoke()
} catch (throwable: Throwable) {
logError(throwable)
return null
}
}

/** Catches any exception (or error) and only logs it.
* Will return null on exceptions. */
fun <T> safe(apiCall: () -> T): T? {
Expand All @@ -112,20 +98,6 @@ suspend fun <T> safeAsync(apiCall: suspend () -> T): T? {
}
}

@Deprecated(
"Outdated function, use `safeAsync` instead",
replaceWith = ReplaceWith("safeAsync"),
level = DeprecationLevel.ERROR
)
suspend fun <T> suspendSafeApiCall(apiCall: suspend () -> T): T? {
return try {
apiCall.invoke()
} catch (throwable: Throwable) {
logError(throwable)
return null
}
}

fun Throwable.getAllMessages(): String {
return (this.localizedMessage ?: "") + (this.cause?.getAllMessages()?.let { "\n$it" } ?: "")
}
Expand Down