When I catch a `CancelledException` from a Corouti...
# coroutines
n
When I catch a
CancelledException
from a Coroutine, can I find out where the cancel originated from? Some of my coroutines are spuriously cancelled and I'm trying to find out why 🤔
g
Yes, same as any other exception, but make sure that you enabled debug mode of coroutines, it will enable stacktrace recovery, so there is higher chance that your will get useful info from cancellation exception
n
Thanks, unfortunately Coroutine debuggin seems to be unavailable on Android...
g
No, it’s available,. you are talking about Debug Agent, which is based on Java Agent API and not available on Android, just enable debug mode, it’s just a runtime feature: https://github.com/Kotlin/kotlinx.coroutines/blob/master/docs/debugging.md#debug-mode
n
Hm, stacktraces didn't change... But I found the bug by other means, so thanks anyways 😄