Quick question, should I ever throw CancellationEx...
# coroutines
r
Quick question, should I ever throw CancellationException manually? We have some old network api implementation that throws CancellationException manually when the auth token is missing in our storage
r
It's better to have a proper exception type
plus1 2
👍 2
r
We do have a proper exception but it is being caught and then the CancellationException is being thrown. I believe it was done in order to cancel all work and log out the user
s
Throwing a cancellation exception manually can have very unpredictable results, it's definitely not a good idea to rely on it
👍 4
👍🏼 1
If you want to cancel something, always call
cancel()
.