chore: Don't use generic log message

This commit is contained in:
Ahmad Ansori Palembani 2024-10-10 09:32:47 +07:00
parent 0ebf79fcb0
commit 15ca197c4e
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
22 changed files with 28 additions and 28 deletions

View file

@ -107,7 +107,7 @@ class BackupCreator(
return fileUri.toString() return fileUri.toString()
} catch (e: Exception) { } catch (e: Exception) {
Logger.e(e) Logger.e(e) { if (file == null) "Unable to retrieve backup destination" else "Invalid backup destination" }
file?.delete() file?.delete()
throw e throw e
} }

View file

@ -145,7 +145,7 @@ class CoverCache(val context: Context) {
} }
} }
} catch (e: Exception) { } catch (e: Exception) {
Logger.e(e) Logger.e(e) { "Unable to delete unused cover cache" }
} }
lastClean = System.currentTimeMillis() lastClean = System.currentTimeMillis()
} }

View file

@ -190,7 +190,7 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
finishUpdates(true) finishUpdates(true)
Result.success() Result.success()
} else { } else {
Logger.e(e) Logger.e(e) { "Failed to update library" }
Result.failure() Result.failure()
} }
} finally { } finally {
@ -231,7 +231,7 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
try { try {
requestSemaphore.withPermit { updateMangaInSource(source) } requestSemaphore.withPermit { updateMangaInSource(source) }
} catch (e: Exception) { } catch (e: Exception) {
Logger.e(e) Logger.e(e) { "Unable to update manga" }
false false
} }
} }

View file

@ -52,7 +52,7 @@ class DelayedTrackingUpdateJob(context: Context, workerParams: WorkerParameters)
service.update(track, true) service.update(track, true)
db.insertTrack(track).executeAsBlocking() db.insertTrack(track).executeAsBlocking()
} catch (e: Exception) { } catch (e: Exception) {
Logger.e(e) Logger.e(e) { "Unable to update tracker [tracker id ${track.sync_id}]" }
} }
} }
} }

View file

@ -227,7 +227,7 @@ class Anilist(private val context: Context, id: Long) : TrackService(id) {
scorePreference.set(scoreType) scorePreference.set(scoreType)
true to null true to null
} catch (e: Exception) { } catch (e: Exception) {
Logger.e(e) Logger.e(e) { "Failed to update scoring" }
false to e false to e
} }
} }
@ -246,7 +246,7 @@ class Anilist(private val context: Context, id: Long) : TrackService(id) {
return try { return try {
json.decodeFromString<ALOAuth>(trackPreferences.trackToken(this).get()) json.decodeFromString<ALOAuth>(trackPreferences.trackToken(this).get())
} catch (e: Exception) { } catch (e: Exception) {
Logger.e(e) Logger.e(e) { "Unable to load token" }
null null
} }
} }

View file

@ -125,7 +125,7 @@ class Bangumi(private val context: Context, id: Long) : TrackService(id) {
saveCredentials(oauth.userId.toString(), oauth.accessToken) saveCredentials(oauth.userId.toString(), oauth.accessToken)
return true return true
} catch (e: Exception) { } catch (e: Exception) {
Logger.e(e) Logger.e(e) { "Unable to login" }
logout() logout()
} }
return false return false

View file

@ -142,7 +142,7 @@ class Kitsu(private val context: Context, id: Long) : TrackService(id) {
saveCredentials(username, userId) saveCredentials(username, userId)
true true
} catch (e: Exception) { } catch (e: Exception) {
Logger.e(e) Logger.e(e) { "Unable to login" }
false false
} }
} }

View file

@ -133,7 +133,7 @@ class MyAnimeList(private val context: Context, id: Long) : TrackService(id) {
saveCredentials(username, oauth.accessToken) saveCredentials(username, oauth.accessToken)
true true
} catch (e: Exception) { } catch (e: Exception) {
Logger.e(e) Logger.e(e) { "Unable to login" }
logout() logout()
false false
} }

View file

@ -125,7 +125,7 @@ class Shikimori(private val context: Context, id: Long) : TrackService(id) {
saveCredentials(user.toString(), oauth.accessToken) saveCredentials(user.toString(), oauth.accessToken)
true true
} catch (e: java.lang.Exception) { } catch (e: java.lang.Exception) {
Logger.e(e) Logger.e(e) { "Unable to login" }
logout() logout()
false false
} }

View file

@ -24,7 +24,7 @@ class AppUpdateJob(private val context: Context, workerParams: WorkerParameters)
AppUpdateChecker().checkForUpdate(context) AppUpdateChecker().checkForUpdate(context)
Result.success() Result.success()
} catch (e: Exception) { } catch (e: Exception) {
Logger.e(e) Logger.e(e) { "Unable to check for update" }
Result.failure() Result.failure()
} }
} }

View file

@ -157,7 +157,7 @@ internal class ExtensionInstaller(private val context: Context) {
} }
.flowOn(Dispatchers.IO) .flowOn(Dispatchers.IO)
.catch { e -> .catch { e ->
Logger.e(e) Logger.e(e) { "Extension installation failed" }
emit(InstallStep.Error to null) emit(InstallStep.Error to null)
} }
.onCompletion { .onCompletion {

View file

@ -221,7 +221,7 @@ class LocalSource(private val context: Context) : CatalogueSource, UnmeteredSour
return@withIOContext rt return@withIOContext rt
} }
} catch (e: Exception) { } catch (e: Exception) {
Logger.e(e) Logger.e(e) { "Something went wrong while trying to load manga details" }
} }
return@withIOContext manga return@withIOContext manga
@ -315,7 +315,7 @@ class LocalSource(private val context: Context) : CatalogueSource, UnmeteredSour
try { try {
updateCover(chapter, manga) updateCover(chapter, manga)
} catch (e: Exception) { } catch (e: Exception) {
Logger.e(e) Logger.e(e) { "Unable to update cover" }
} }
} }
} }

View file

@ -233,7 +233,7 @@ class MigrationListController(bundle: Bundle? = null) :
val chapters: List<SChapter> = try { val chapters: List<SChapter> = try {
source.getChapterList(localManga) source.getChapterList(localManga)
} catch (e: java.lang.Exception) { } catch (e: java.lang.Exception) {
Logger.e(e) Logger.e(e) { "Something went wrong while trying to retrieve chapter list" }
emptyList() emptyList()
} }
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {

View file

@ -388,7 +388,7 @@ class ReaderViewModel(
if (e is CancellationException) { if (e is CancellationException) {
throw e throw e
} }
Logger.e(e) Logger.e(e) { "Unable to load new chapter" }
} }
} }
} }
@ -440,7 +440,7 @@ class ReaderViewModel(
if (e is CancellationException) { if (e is CancellationException) {
throw e throw e
} }
Logger.e(e) Logger.e(e) { "Unable to load adjacent chapter" }
lastPage = null lastPage = null
} finally { } finally {
mutableState.update { it.copy(isLoadingAdjacentChapter = false) } mutableState.update { it.copy(isLoadingAdjacentChapter = false) }

View file

@ -203,7 +203,7 @@ class WebtoonPageHolder(
removeErrorLayout() removeErrorLayout()
} }
} catch (e: Exception) { } catch (e: Exception) {
Logger.e(e) Logger.e(e) { "Unable to load page" }
withUIContext { withUIContext {
setError() setError()
} }

View file

@ -494,7 +494,7 @@ class SettingsAdvancedController : SettingsLegacyController() {
activity?.applicationInfo?.dataDir?.let { File("$it/app_webview/").deleteRecursively() } activity?.applicationInfo?.dataDir?.let { File("$it/app_webview/").deleteRecursively() }
activity?.toast(MR.strings.webview_data_deleted) activity?.toast(MR.strings.webview_data_deleted)
} catch (e: Throwable) { } catch (e: Throwable) {
Logger.e(e) Logger.e(e) { "Unable to delete WebView data" }
activity?.toast(MR.strings.cache_delete_error) activity?.toast(MR.strings.cache_delete_error)
} }
} }

View file

@ -188,7 +188,7 @@ open class BrowseSourcePresenter(
this@BrowseSourcePresenter.items.addAll(items) this@BrowseSourcePresenter.items.addAll(items)
withUIContext { view?.onAddPage(page, items) } withUIContext { view?.onAddPage(page, items) }
} catch (error: Exception) { } catch (error: Exception) {
Logger.e(error) Logger.e(error) { "Unable to prepare a page" }
} }
}.collect() }.collect()
} }
@ -259,7 +259,7 @@ open class BrowseSourcePresenter(
.onEach { .onEach {
withUIContext { view?.onMangaInitialized(it) } withUIContext { view?.onMangaInitialized(it) }
} }
.catch { e -> Logger.e(e) } .catch { e -> Logger.e(e) { "Unable to initialize manga" } }
.collect() .collect()
} }
} }
@ -277,7 +277,7 @@ open class BrowseSourcePresenter(
manga.initialized = true manga.initialized = true
db.insertManga(manga).executeAsBlocking() db.insertManga(manga).executeAsBlocking()
} catch (e: Exception) { } catch (e: Exception) {
Logger.e(e) Logger.e(e) { "Something went wrong while trying to initialize manga" }
} }
return manga return manga
} }

View file

@ -113,7 +113,7 @@ suspend fun updateTrackChapterRead(
service.update(track, true) service.update(track, true)
db.insertTrack(track).executeAsBlocking() db.insertTrack(track).executeAsBlocking()
} catch (e: Exception) { } catch (e: Exception) {
Logger.e(e) Logger.e(e) { "Unable to update tracker [tracker id ${track.sync_id}]" }
failures.add(service to e.localizedMessage) failures.add(service to e.localizedMessage)
if (retryWhenOnline) { if (retryWhenOnline) {
delayTrackingUpdate(preferences, mangaId, newChapterRead, track) delayTrackingUpdate(preferences, mangaId, newChapterRead, track)

View file

@ -445,6 +445,6 @@ suspend fun <T> withNonCancellableContext(block: suspend CoroutineScope.() -> T)
fun Context.tryTakePersistableUriPermission(uri: Uri, flags: Int) = try { fun Context.tryTakePersistableUriPermission(uri: Uri, flags: Int) = try {
contentResolver.takePersistableUriPermission(uri, flags) contentResolver.takePersistableUriPermission(uri, flags)
} catch (e: SecurityException) { } catch (e: SecurityException) {
Logger.e(e) Logger.e(e) { "Persists URI permission is not supported in this device" }
toast(MR.strings.file_picker_uri_permission_unsupported) toast(MR.strings.file_picker_uri_permission_unsupported)
} }

View file

@ -583,7 +583,7 @@ object ImageUtil {
splitDataList splitDataList
.map { splitImageName(fileName, it.index) } .map { splitImageName(fileName, it.index) }
.forEach { tmpDir.findFile(it)?.delete() } .forEach { tmpDir.findFile(it)?.delete() }
Logger.e(e) Logger.e(e) { "Unable to save split image" }
false false
} finally { } finally {
bitmapRegionDecoder.recycle() bitmapRegionDecoder.recycle()

View file

@ -279,7 +279,7 @@ object SettingsDataScreen : ComposableSettings {
cacheReadableSizeSema++ cacheReadableSizeSema++
} }
} catch (e: Throwable) { } catch (e: Throwable) {
Logger.e(e) Logger.e(e) { "Unable to clear cache" }
withUIContext { context.toast(MR.strings.cache_delete_error) } withUIContext { context.toast(MR.strings.cache_delete_error) }
} }
} }

View file

@ -17,7 +17,7 @@ object WebViewUtil {
// is not installed // is not installed
CookieManager.getInstance() CookieManager.getInstance()
} catch (e: Throwable) { } catch (e: Throwable) {
Logger.e(e) Logger.e(e) { "Unable to manage cookie for WebView" }
return false return false
} }