From 1b71e4cee74e157ef8ed153cbbc526fd3d3513ee Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 26 Jan 2022 22:21:01 -0500 Subject: [PATCH] Write job failure exceptions to error log --- .../java/eu/kanade/tachiyomi/data/backup/BackupCreatorJob.kt | 3 +++ .../eu/kanade/tachiyomi/data/track/job/DelayedTrackingStore.kt | 3 ++- .../main/java/eu/kanade/tachiyomi/data/updater/AppUpdateJob.kt | 3 +++ .../java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt | 3 +++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreatorJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreatorJob.kt index 7953906d5..bfaa407aa 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreatorJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreatorJob.kt @@ -9,6 +9,8 @@ import androidx.work.Worker import androidx.work.WorkerParameters import eu.kanade.tachiyomi.data.backup.full.FullBackupManager import eu.kanade.tachiyomi.data.preference.PreferencesHelper +import eu.kanade.tachiyomi.util.system.logcat +import logcat.LogPriority import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.util.concurrent.TimeUnit @@ -24,6 +26,7 @@ class BackupCreatorJob(private val context: Context, workerParams: WorkerParamet FullBackupManager(context).createBackup(uri, flags, true) Result.success() } catch (e: Exception) { + logcat(LogPriority.ERROR, e) Result.failure() } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/job/DelayedTrackingStore.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/job/DelayedTrackingStore.kt index e2a7b9091..e0c968f08 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/job/DelayedTrackingStore.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/job/DelayedTrackingStore.kt @@ -18,7 +18,7 @@ class DelayedTrackingStore(context: Context) { val (_, lastChapterRead) = preferences.getString(trackId, "0:0.0")!!.split(":") if (track.last_chapter_read > lastChapterRead.toFloat()) { val value = "${track.manga_id}:${track.last_chapter_read}" - logcat(LogPriority.INFO) { "Queuing track item: $trackId, $value" } + logcat(LogPriority.DEBUG) { "Queuing track item: $trackId, $value" } preferences.edit { putString(trackId, value) } @@ -31,6 +31,7 @@ class DelayedTrackingStore(context: Context) { } } + @Suppress("UNCHECKED_CAST") fun getItems(): List { return (preferences.all as Map).entries .map { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateJob.kt index bb3d2a76c..20a433a01 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateJob.kt @@ -9,7 +9,9 @@ import androidx.work.PeriodicWorkRequestBuilder import androidx.work.WorkManager import androidx.work.WorkerParameters import eu.kanade.tachiyomi.BuildConfig +import eu.kanade.tachiyomi.util.system.logcat import kotlinx.coroutines.coroutineScope +import logcat.LogPriority import java.util.concurrent.TimeUnit class AppUpdateJob(private val context: Context, workerParams: WorkerParameters) : @@ -20,6 +22,7 @@ class AppUpdateJob(private val context: Context, workerParams: WorkerParameters) AppUpdateChecker().checkForUpdate(context) Result.success() } catch (e: Exception) { + logcat(LogPriority.ERROR, e) Result.failure() } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt index bdcd7a1d8..837336644 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt @@ -15,8 +15,10 @@ import eu.kanade.tachiyomi.data.notification.NotificationReceiver import eu.kanade.tachiyomi.data.notification.Notifications import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.extension.api.ExtensionGithubApi +import eu.kanade.tachiyomi.util.system.logcat import eu.kanade.tachiyomi.util.system.notification import kotlinx.coroutines.coroutineScope +import logcat.LogPriority import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.util.concurrent.TimeUnit @@ -28,6 +30,7 @@ class ExtensionUpdateJob(private val context: Context, workerParams: WorkerParam val pendingUpdates = try { ExtensionGithubApi().checkForUpdates(context) } catch (e: Exception) { + logcat(LogPriority.ERROR, e) return@coroutineScope Result.failure() }