Когда я вызываю конечную точку, я получаю исключение io; однако на моем мобильном устройстве я получаю push-уведомление (это ожидаемо), и сетевой инспектор говорит, что ответ — HTTP 200. Я не исключаю ничего в своем ответе, меня просто волнует, нормальный ли это HTTP. или что-то еще.
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))
}
}
}
В своих логах я вижу пункт 1, а дальше только это:
E IOException: null, [ L j a v a . l a n g . S t a c k T r a c e E l e m e n t ; @ 1 5 c 8 8 5 1 } < b r / > 2 0 2 4 - 0 6 - 2 8 2 2 : 1 5 : 3 9 . 7 0 4 2 4 0 6 6 - 2 4 0 6 6 S y s t e m . e r r e u . e u r o p a . e c . e c a s W j a v a . i o . E O F E x c e p t i o n < b r / > 2 0 2 4 - 0 6 - 2 8 2 2 : 1 5 : 3 9 . 7 0 4 2 4 0 6 6 - 2 4 0 6 6 S y s t e m . e r r e u . e u r o p a . e c . e c a s W a t j a v a . l a n g . r e f l e c t . C o n s t r u c t o r . n e w I n s t a n c e 0 ( N a t i v e M e t h o d ) < b r / > 2 0 2 4 - 0 6 - 2 8 2 2 : 1 5 : 3 9 . 7 0 4 2 4 0 6 6 - 2 4 0 6 6 S y s t e m . e r r e u . e u r o p a . e c . e c a s W a t j a v a . l a n g . r e f l e c t . C o n s t r u c t o r . n e w I n s t a n c e ( C o n s t r u c t o r . j a v a : 3 4 3 ) < b r / > 2 0 2 4 - 0 6 - 2 8 2 2 : 1 5 : 3 9 . 7 0 4 2 4 0 6 6 - 2 4 0 6 6 S y s t e m . e r r e u . e u r o p a . e c . e c a s W a t i o . k t o r . u t i l s . i o . E x c e p t i o n U t i l s J v m K t $ c r e a t e C o n s t r u c t o r $ $ i n l i n e d $ s a f e C t o r $ 3 . i n v o k e ( S o u r c e F i l e : 8 1 ) < b r / > 2 0 2 4 - 0 6 - 2 8 2 2 : 1 5 : 3 9 . 7 0 4 2 4 0 6 6 - 2 4 0 6 6 S y s t e m . e r r e u . e u r o p a . e c . e c a s W a t i o . k t o r . u t i l s . i o . E x c e p t i o n U t i l s J v m K t $ c r e a t e C o n s t r u c t o r $ $ i n l i n e d $ s a f e C t o r $ 3 . i n v o k e ( S o u r c e F i l e : 9 0 ) < b r / > 2 0 2 4 - 0 6 - 2 8 2 2 : 1 5 : 3 9 . 7 0 4 2 4 0 6 6 - 2 4 0 6 6 S y s t e m . e r r e u . e u r o p a . e c . e c a s W a t i o . k t o r . u t i l s . i o . E x c e p t i o n U t i l s J v m K t . t r y C o p y E x c e p t i o n ( S o u r c e F i l e : 6 6 ) < b r / > 2 0 2 4 - 0 6 - 2 8 2 2 : 1 5 : 3 9 . 7 0 4 2 4 0 6 6 - 2 4 0 6 6 S y s t e m . e r r e u . e u r o p a . e c . e c a s W a t i o . k t o r . u t i l s . i o . B y t e B u f f e r C h a n n e l K t . r e t h r o w C l o s e d ( S o u r c e F i le: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)
Подробнее здесь: https://stackoverflow.com/questions/786 ... 0-response
Клиент Ktor выдает исключение ввода-вывода в Android в ответе http 200 ⇐ Android
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Клиент Ktor выдает исключение ввода-вывода в Android в ответе http 200
Anonymous » » в форуме Android - 0 Ответы
- 11 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Клиент Ktor выдает исключение ввода-вывода в Android в ответе http 200
Anonymous » » в форуме Android - 0 Ответы
- 11 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Клиент Ktor выдает исключение ввода-вывода в Android в ответе http 200
Anonymous » » в форуме Android - 0 Ответы
- 14 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Java HTTP-клиент выдает 403, тогда как почтальон всегда выдает 200 [закрыто]
Anonymous » » в форуме JAVA - 0 Ответы
- 33 Просмотры
-
Последнее сообщение Anonymous
-