Skip to content

Commit

Permalink
Merge pull request #93 from fingerprintjs/fix/execute_safe_function_n…
Browse files Browse the repository at this point in the history
…ot_catching_errors

executeSafe: catch errors along with exceptions.
  • Loading branch information
Sergey-Makarov authored Jun 21, 2023
2 parents 1cf5ffd + ec0d871 commit 62a9d2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 4 additions & 0 deletions fingerprint/lint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<lint>
<!-- TODO: remove this rule and update to the latest target SDK -->
<issue id="OldTargetApi" severity="informational" />
</lint>
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 62a9d2b

Please sign in to comment.