https://kotlinlang.org logo
#coroutines
Title
# coroutines
r

Rechee Jozil

08/10/2020, 11:40 PM
so usually in my code when I handle exceptions in a suspend function, I always first check if the exception is a cancellation exception before trying to log or otherwise. If it's CancellationException I just rethrow. Is this what others do? Is there a more... idiomatic/simple way to do this? It's a very common pattern for me (or maybe I'm just handling things incorrectly).
o

octylFractal

08/10/2020, 11:43 PM
unfortunately not right now, https://github.com/Kotlin/kotlinx.coroutines/issues/1814 is the related issue
r

Rechee Jozil

08/10/2020, 11:46 PM
ah @octylFractal thanks for the link. I actually started to write my own runCatching function to handle this situation too. I'll go post my own comment on that issue.
👍 1
3 Views