From ed407bb1d93cd23be3c18d94b0c0e80c4bb4afb9 Mon Sep 17 00:00:00 2001 From: Mike Hardy Date: Wed, 20 Nov 2024 20:22:53 -0500 Subject: [PATCH] fix: stop reporting storage access exceptions to acrarium these no longer generate useful reports --- AnkiDroid/src/main/java/com/ichi2/anki/CoroutineHelpers.kt | 4 +++- AnkiDroid/src/main/java/com/ichi2/anki/InitialActivity.kt | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/CoroutineHelpers.kt b/AnkiDroid/src/main/java/com/ichi2/anki/CoroutineHelpers.kt index 8c5dacbd4a96..a5ef19fe480e 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/CoroutineHelpers.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/CoroutineHelpers.kt @@ -32,6 +32,7 @@ import androidx.lifecycle.viewModelScope import anki.collection.Progress import com.ichi2.anki.CollectionManager.TR import com.ichi2.anki.CollectionManager.withCol +import com.ichi2.anki.exception.StorageAccessException import com.ichi2.anki.snackbar.showSnackbar import com.ichi2.libanki.Collection import com.ichi2.utils.message @@ -169,8 +170,9 @@ suspend fun FragmentActivity.runCatching( Timber.w(exc, errorMessage) exc.localizedMessage?.let { showSnackbar(it) } } - is BackendNetworkException, is BackendSyncException -> { + is BackendNetworkException, is BackendSyncException, is StorageAccessException -> { // these exceptions do not generate worthwhile crash reports + Timber.i("Showing error dialog but not sending a crash report.") showError(this, exc.localizedMessage!!, exc, false) } is BackendException -> { diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/InitialActivity.kt b/AnkiDroid/src/main/java/com/ichi2/anki/InitialActivity.kt index df447f1bf7cf..6da8f050ed5c 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/InitialActivity.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/InitialActivity.kt @@ -29,6 +29,7 @@ import androidx.annotation.RequiresApi import androidx.appcompat.app.AlertDialog import androidx.core.content.edit import androidx.core.content.pm.PackageInfoCompat +import com.ichi2.anki.exception.StorageAccessException import com.ichi2.anki.servicelayer.PreferenceUpgradeService import com.ichi2.anki.servicelayer.PreferenceUpgradeService.setPreferencesUpToDate import com.ichi2.anki.servicelayer.ScopedStorageService.isLegacyStorage @@ -68,6 +69,11 @@ object InitialActivity { } catch (e: SQLiteFullException) { Timber.w(e) StartupFailure.DISK_FULL + } catch (e: StorageAccessException) { + // Same handling as the fall through, but without the exception report + // These are now handled with a dialog and don't generate actionable reports + Timber.w(e) + StartupFailure.DB_ERROR } catch (e: Exception) { Timber.w(e) CrashReportService.sendExceptionReport(e, "InitialActivity::getStartupFailureType")