mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-16 15:49:16 +01:00
Catch error properly when app update check fails (fixes #8019)
This commit is contained in:
parent
83871fc013
commit
7ec822503a
@ -133,10 +133,10 @@ class AppUpdateService : Service() {
|
|||||||
throw Exception("Unsuccessful response")
|
throw Exception("Unsuccessful response")
|
||||||
}
|
}
|
||||||
notifier.promptInstall(apkFile.getUriCompat(this))
|
notifier.promptInstall(apkFile.getUriCompat(this))
|
||||||
} catch (error: Exception) {
|
} catch (e: Exception) {
|
||||||
logcat(LogPriority.ERROR, error)
|
logcat(LogPriority.ERROR, e)
|
||||||
if (error is CancellationException ||
|
if (e is CancellationException ||
|
||||||
(error is StreamResetException && error.errorCode == ErrorCode.CANCEL)
|
(e is StreamResetException && e.errorCode == ErrorCode.CANCEL)
|
||||||
) {
|
) {
|
||||||
notifier.cancel()
|
notifier.cancel()
|
||||||
} else {
|
} else {
|
||||||
|
@ -45,9 +45,9 @@ class AboutController : BasicFullComposeController() {
|
|||||||
activity!!.toast(R.string.update_check_look_for_updates)
|
activity!!.toast(R.string.update_check_look_for_updates)
|
||||||
|
|
||||||
viewScope.launchIO {
|
viewScope.launchIO {
|
||||||
|
try {
|
||||||
val result = updateChecker.checkForUpdate(activity!!, isUserPrompt = true)
|
val result = updateChecker.checkForUpdate(activity!!, isUserPrompt = true)
|
||||||
withUIContext {
|
withUIContext {
|
||||||
try {
|
|
||||||
when (result) {
|
when (result) {
|
||||||
is AppUpdateResult.NewUpdate -> {
|
is AppUpdateResult.NewUpdate -> {
|
||||||
NewUpdateDialogController(result).showDialog(router)
|
NewUpdateDialogController(result).showDialog(router)
|
||||||
@ -57,10 +57,10 @@ class AboutController : BasicFullComposeController() {
|
|||||||
}
|
}
|
||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
} catch (error: Exception) {
|
|
||||||
activity?.toast(error.message)
|
|
||||||
logcat(LogPriority.ERROR, error)
|
|
||||||
}
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
withUIContext { activity?.toast(e.message) }
|
||||||
|
logcat(LogPriority.ERROR, e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,9 +37,9 @@ fun Call.asObservable(): Observable<Response> {
|
|||||||
subscriber.onNext(response)
|
subscriber.onNext(response)
|
||||||
subscriber.onCompleted()
|
subscriber.onCompleted()
|
||||||
}
|
}
|
||||||
} catch (error: Exception) {
|
} catch (e: Exception) {
|
||||||
if (!subscriber.isUnsubscribed) {
|
if (!subscriber.isUnsubscribed) {
|
||||||
subscriber.onError(error)
|
subscriber.onError(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user