Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package dev.icerock.moko.errors.handler
import dev.icerock.moko.errors.ErrorEventListener
import dev.icerock.moko.errors.HandlerResult
import dev.icerock.moko.mvvm.dispatcher.EventsDispatcher
import kotlinx.coroutines.CancellationException
import kotlin.reflect.KClass

private typealias Catcher = (Throwable) -> Boolean
Expand Down Expand Up @@ -38,7 +39,9 @@ internal class ExceptionHandlerContextImpl<T : Any, R>(
override suspend fun execute(): HandlerResult<R, Throwable> {
return try {
HandlerResult.Success(block())
} catch (e: Throwable) {
} catch (e: Exception) {
// Don't handle coroutines CancellationException
if (e is CancellationException) throw e
onCatch?.invoke(e)
val isHandled = catchersMap[e::class]?.invoke(e)
if (isHandled == null || isHandled == false) {
Expand Down