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:
Aayush Gupta
2025-03-17 14:17:24 +08:00
parent 075c6e1c05
commit 655c7cd59f

View File

@@ -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 {