Cancelling coroutines operations such as authentication no longer displays an errors as it's something intentional
This commit is contained in:
parent
3b248f10eb
commit
a920e2bb9e
@ -78,7 +78,9 @@ class TabState @Inject constructor(
|
||||
|
||||
refreshEvenIfCrashesInteractiveResult = refreshEvenIfCrashesInteractive?.invoke(ex) ?: false
|
||||
|
||||
if (showError)
|
||||
val containsCancellation = exceptionContainsCancellation(ex)
|
||||
|
||||
if (showError && !containsCancellation)
|
||||
errorsManager.addError(newErrorNow(ex, ex.message.orEmpty()))
|
||||
} finally {
|
||||
_processing.value = false
|
||||
@ -91,6 +93,15 @@ class TabState @Inject constructor(
|
||||
|
||||
}
|
||||
|
||||
private fun exceptionContainsCancellation(ex: Throwable?): Boolean {
|
||||
return when (ex) {
|
||||
null -> false
|
||||
ex.cause -> false
|
||||
is CancellationException -> true
|
||||
else -> exceptionContainsCancellation(ex.cause)
|
||||
}
|
||||
}
|
||||
|
||||
fun safeProcessingWithoutGit(showError: Boolean = true, callback: suspend CoroutineScope.() -> Unit) =
|
||||
scope.launch(Dispatchers.IO) {
|
||||
_processing.value = true
|
||||
|
Loading…
Reference in New Issue
Block a user