We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When i try to test ViewModel that use ExceptionHandler i need to create test version of ExceptionHandler. here draft:
import dev.icerock.moko.errors.handler.ExceptionHandler import dev.icerock.moko.errors.handler.ExceptionMapper expect class TestsExceptionHandler<T : Any>( exceptionMapper: ExceptionMapper<T> ) : ExceptionHandler { val catchedExceptions: List<Throwable> }
android:
import androidx.fragment.app.FragmentActivity import androidx.lifecycle.LifecycleOwner import dev.icerock.moko.errors.handler.ExceptionHandler import dev.icerock.moko.errors.handler.ExceptionHandlerContext import dev.icerock.moko.errors.handler.ExceptionMapper import dev.icerock.moko.mvvm.dispatcher.EventsDispatcher actual class TestsExceptionHandler<T : Any> actual constructor( private val exceptionMapper: ExceptionMapper<T> ) : ExceptionHandler { private val _catchedExceptions = mutableListOf<Throwable>() actual val catchedExceptions: List<Throwable> = _catchedExceptions override fun bind(lifecycleOwner: LifecycleOwner, activity: FragmentActivity) { TODO("Not yet implemented") } override fun <R> handle(block: suspend () -> R): ExceptionHandlerContext<R> { return ExceptionHandlerContext.invoke( exceptionMapper = exceptionMapper, eventsDispatcher = EventsDispatcher(), onCatch = _catchedExceptions::add, block = block ) } }
ios:
import dev.icerock.moko.errors.handler.ExceptionHandler import dev.icerock.moko.errors.handler.ExceptionHandlerContext import dev.icerock.moko.errors.handler.ExceptionMapper import dev.icerock.moko.mvvm.dispatcher.EventsDispatcher import platform.UIKit.UIViewController actual class TestsExceptionHandler<T : Any> actual constructor( private val exceptionMapper: ExceptionMapper<T> ) : ExceptionHandler { private val _catchedExceptions = mutableListOf<Throwable>() actual val catchedExceptions: List<Throwable> = _catchedExceptions override fun <R> handle(block: suspend () -> R): ExceptionHandlerContext<R> { return ExceptionHandlerContext.invoke( exceptionMapper = exceptionMapper, eventsDispatcher = EventsDispatcher(), onCatch = _catchedExceptions::add, block = block ) } override fun bind(viewController: UIViewController) { TODO("Not yet implemented") } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When i try to test ViewModel that use ExceptionHandler i need to create test version of ExceptionHandler.
here draft:
android:
ios:
The text was updated successfully, but these errors were encountered: