Skip to content

Commit

Permalink
debug: skip arithmetic exceptions for android
Browse files Browse the repository at this point in the history
  • Loading branch information
siddarthkay committed Sep 14, 2024
1 parent 73ba834 commit de25cbf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions android/app/src/main/java/im/status/ethereum/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ class MainActivity : NavigationActivity(), ActivityCompat.OnRequestPermissionsRe
val defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler()
// High priority, so don't use StatusThreadPoolExecutor
Thread.setDefaultUncaughtExceptionHandler { thread, t ->
Thread {
if (t.message?.contains("Loss of precision during arithmetic conversion") == true) {
// Skip this exception
Log.e("RNError", "Caught harmless arithmetic conversion error", t)
} else {
Thread {
Looper.prepare()
AlertDialog.Builder(context)
.setTitle("Error")
Expand All @@ -63,7 +67,8 @@ class MainActivity : NavigationActivity(), ActivityCompat.OnRequestPermissionsRe
defaultUncaughtExceptionHandler.uncaughtException(thread, t)
}.show()
Looper.loop()
}.start()
}.start()
}
}
}

Expand Down

0 comments on commit de25cbf

Please sign in to comment.