summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2020-09-05 20:33:25 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2020-09-05 22:49:36 +0530
commit4082be7721eb490f3d96825697a50ba99c80d136 (patch)
treed0b3d56da516927949c86855436b2adf7922752c /app
parentc62e1303b1258728fb7ac7e11053e39b3736aa96 (diff)
AutofillPublisherChangedActivity: use runCatching to replace exception handling
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillPublisherChangedActivity.kt8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillPublisherChangedActivity.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillPublisherChangedActivity.kt
index d71d6f2d..bcb27e65 100644
--- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillPublisherChangedActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillPublisherChangedActivity.kt
@@ -16,6 +16,8 @@ import android.text.format.DateUtils
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.github.ajalt.timberkt.e
+import com.github.michaelbull.result.onFailure
+import com.github.michaelbull.result.runCatching
import com.zeapo.pwdstore.R
import com.zeapo.pwdstore.autofill.oreo.AutofillMatcher
import com.zeapo.pwdstore.autofill.oreo.AutofillPublisherChangedException
@@ -76,7 +78,7 @@ class AutofillPublisherChangedActivity : AppCompatActivity() {
}
private fun showPackageInfo() {
- try {
+ runCatching {
with(binding) {
val packageInfo =
packageManager.getPackageInfo(appPackage, PackageManager.GET_META_DATA)
@@ -94,8 +96,8 @@ class AutofillPublisherChangedActivity : AppCompatActivity() {
currentHash
)
}
- } catch (exception: Exception) {
- e(exception) { "Failed to retrieve package info for $appPackage" }
+ }.onFailure { e ->
+ e(e) { "Failed to retrieve package info for $appPackage" }
finish()
}
}