So.. is it safe to use `runCatching` in coroutines...
# coroutines
u
So.. is it safe to use
runCatching
in coroutines for control flow? I gather it will catch CancelationException as well. Won't that break stuff?
👍 1
e
It depends, but in general I wouldn't use it, because you'll also catch
CancellationException
, which you usually don't want to catch by default
See an interesting discussion here: https://github.com/Kotlin/kotlinx.coroutines/issues/1814 I commented there too, because I had the same question as you and I did some more research
d
that is what I had in mind, I was wondering if there was some ‘standard’, but I can just write it and use it in my project. Thanks!
🙂 1