DownloadWorker: Notify dowload failure on network error as well
We can do special handling when ready but failure is a failure regardless. Notify the user about it. Also remove non-required default exception parameter as all instances of onFailure specify an appropriate exception. Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -205,7 +205,7 @@ class DownloadWorker @AssistedInject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun onFailure(exception: Exception = Exception("Something went wrong!")): Result =
|
||||
private suspend fun onFailure(exception: Exception): Result =
|
||||
withContext(NonCancellable) {
|
||||
Log.i(TAG, "Job failed: ${download.packageName}", exception)
|
||||
|
||||
@@ -218,10 +218,6 @@ class DownloadWorker @AssistedInject constructor(
|
||||
notifyStatus(DownloadStatus.CANCELLED)
|
||||
}
|
||||
|
||||
is NoNetworkException -> {
|
||||
// TODO: Notify user of network failure, maybe a notification & retry option
|
||||
}
|
||||
|
||||
else -> {
|
||||
notifyStatus(DownloadStatus.FAILED)
|
||||
AuroraApp.events.send(InstallerEvent.Failed(download.packageName).apply {
|
||||
|
||||
Reference in New Issue
Block a user