Skip to content

Commit

Permalink
executeSafe: catch errors along with exceptions.
Browse files Browse the repository at this point in the history
Fixes #92
  • Loading branch information
Sergey-Makarov committed Jun 21, 2023
1 parent 1cf5ffd commit 6c005fc
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package com.fingerprintjs.android.fingerprint.tools

import java.lang.Exception


@Deprecated(message = DeprecationMessages.UTIL_UNINTENDED_PUBLIC_API)
public fun <T> executeSafe(code: () -> T, defaultValue: T): T {
return try {
code()
} catch (exception: Exception) {
} catch (_: Throwable) {
defaultValue
}
}

0 comments on commit 6c005fc

Please sign in to comment.