Handle CancellationException

This commit is contained in:
Mygod
2021-10-25 01:11:53 -04:00
parent 7fa39e9994
commit dd0d58af67
2 changed files with 5 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ import timber.log.Timber
import java.net.HttpURLConnection
import java.net.URL
import java.time.Instant
import java.util.concurrent.CancellationException
import java.util.concurrent.TimeUnit
import kotlin.math.max
@@ -56,6 +57,8 @@ object UpdateChecker {
putLong(KEY_PUBLISHED, published)
}
emit(if (myVersion == version) null else GitHubUpdate(version, published))
} catch (e: CancellationException) {
return@flow
} catch (e: Exception) {
Timber.w(e)
} finally {