When I call an endpoint, I receive an io exception; however, on my mobile device, I receive the push notification (that’s expected), and the network inspector says that the response is HTTP 200. I don’t except any body in my answer I’m simply care if this is an ok HTTP or something else.
return flow {
try {
Timber.e("POINT, 1")
val response: HttpResponse = httpClient.post(url) {
setBody(enrolmentRequestData)
}
Timber.e("POINT, 1 2, ${response.status.value}")
Timber.e("POINT, 1 2, Response body: ${response.bodyAsText()}") // Add this to log the response body if possible
if (response.status == HttpStatusCode.OK) {
emit(Result.Success(Unit))
} else {
handleErrorResponse(response.status.value)
}
} catch (e: ResponseException) {
Timber.e("ResponseException: ${e.response.status.value}, ${e.message}")
handleErrorResponse(e.response.status.value)
} catch (e: JSONException) {
Timber.e("JSONException: ${e.message}")
emit(Result.Error(DataError.Network.JSON_PARSE_EXCEPTION))
} catch (e: IOException) {
Timber.e("IOException: ${e.message}, ${e.stackTrace}}")
e.printStackTrace() // Print full stack trace for better analysis
emit(Result.Error(DataError.Network.NO_INTERNET))
} catch (e: Exception) {
Timber.e("Unknown Exception: ${e.message}, ${e.stackTrace}")
emit(Result.Error(DataError.Network.UNKNOWN_ERROR))
}
}
}
I see point 1 in my logs, and after that, only this:
E IOException: null, [Ljava.lang.StackTraceElement;@15c8851}
2024-06-28 22:15:39.704 24066-24066 System.err eu.europa.ec.ecas W java.io.EOFException
2024-06-28 22:15:39.704 24066-24066 System.err eu.europa.ec.ecas W at java.lang.reflect.Constructor.newInstance0(Native Method)
2024-06-28 22:15:39.704 24066-24066 System.err eu.europa.ec.ecas W at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
2024-06-28 22:15:39.704 24066-24066 System.err eu.europa.ec.ecas W at io.ktor.utils.io.ExceptionUtilsJvmKt$createConstructor$$inlined$safeCtor$3.invoke(SourceFile:81)
2024-06-28 22:15:39.704 24066-24066 System.err eu.europa.ec.ecas W at io.ktor.utils.io.ExceptionUtilsJvmKt$createConstructor$$inlined$safeCtor$3.invoke(SourceFile:90)
2024-06-28 22:15:39.704 24066-24066 System.err eu.europa.ec.ecas W at io.ktor.utils.io.ExceptionUtilsJvmKt.tryCopyException(SourceFile:66)
2024-06-28 22:15:39.704 24066-24066 System.err eu.europa.ec.ecas W at io.ktor.utils.io.ByteBufferChannelKt.rethrowClosed(SourceFile:2404)
2024-06-28 22:15:39.704 24066-24066 System.err eu.europa.ec.ecas W at io.ktor.utils.io.ByteBufferChannelKt.access$rethrowClosed(SourceFile:1)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at io.ktor.utils.io.ByteBufferChannel.readRemaining$suspendImpl(SourceFile:2063)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at io.ktor.utils.io.ByteBufferChannel.readRemaining(Unknown Source:0)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at io.ktor.utils.io.ByteReadChannel$DefaultImpls.readRemaining$default(SourceFile:88)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at io.ktor.client.call.SavedCallKt.save(SourceFile:73)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at io.ktor.client.statement.HttpStatement$execute$4.invokeSuspend(SourceFile:63)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at io.ktor.client.statement.HttpStatement$execute$4.invoke(SourceFile:0)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at io.ktor.client.statement.HttpStatement$execute$4.invoke(SourceFile:0)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at io.ktor.client.statement.HttpStatement.execute(SourceFile:50)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at io.ktor.client.statement.HttpStatement$execute$1.invokeSuspend(Unknown Source:12)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:33)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at kotlinx.coroutines.DispatchedTask.run(SourceFile:102)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at kotlinx.coroutines.EventLoop.processUnconfinedEvent(SourceFile:65)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at kotlinx.coroutines.internal.DispatchedContinuation.resumeWith(SourceFile:199)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SourceFile:135)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at io.ktor.util.pipeline.SuspendFunctionGun.loop(SourceFile:109)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SourceFile:11)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SourceFile:59)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:46)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at kotlinx.coroutines.DispatchedTask.run(SourceFile:102)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at android.os.Handler.handleCallback(Handler.java:959)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at android.os.Handler.dispatchMessage(Handler.java:100)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at android.os.Looper.loopOnce(Looper.java:232)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at android.os.Looper.loop(Looper.java:317)
2024-06-28 22:15:39.705 24066-24066 System.err eu.europa.ec.ecas W at android.app.ActivityThread.main(ActivityThread.java:8592)
2024-06-28 22:15:39.706 24066-24066 System.err eu.europa.ec.ecas W at java.lang.reflect.Method.invoke(Native Method)
2024-06-28 22:15:39.706 24066-24066 System.err eu.europa.ec.ecas W at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
2024-06-28 22:15:39.706 24066-24066 System.err eu.europa.ec.ecas W at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)