icerockdev / moko-network

Network components with codegeneration of rest api for mobile (android & ios) Kotlin Multiplatform development
https://moko.icerock.dev
Apache License 2.0
151 stars 29 forks source link

ErrorException and ValidationException should have additional information about requests #29

Closed Alex009 closed 4 years ago

Alex009 commented 4 years ago

Now, when error exception throw and nobody not catch it we got in crashlytics this trace:

Fatal Exception: dev.icerock.moko.network.exceptions.ErrorException: Missed server heartbeat
       at dev.icerock.moko.network.exceptionfactory.parser.ErrorExceptionParser.parseException(ErrorExceptionParser.kt:34)
       at moto.domain.HttpExceptionFactory.createException(HttpExceptionFactory.kt:18)
       at dev.icerock.moko.network.features.ExceptionFeature$Feature$install$1.invokeSuspend(ExceptionFeature.kt:43)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:561)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:727)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:667)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:655)

we should pass additional info (request + response for example) into exception to improve debug experience