Team <#C1CFAFJSK|coroutines>, is jobCencellationException in flow coroutines is common or how can we...
g
Team #coroutines, is jobCencellationException in flow coroutines is common or how can we avoid this exception
g
Could you please clarify your problem CancellationException is completely fine by itself, is way to propagate cancellation of coroutines, including Flow
g
When am leaving viemodel with logout. Am getting jobCencellationException
c
That’s normal, it’s the mechanism by which coroutines are only active as long as the ViewModel itself is active. You’re not supposed to catch that exception, or if you do you’re supposed to rethrow it to cooperate with cancellation (read more here) Once the ViewModel is cleared, the
viewModelScope
will be cancelled so you don’t have work continuing to run the background wasting system resources.