Skip to content
This repository was archived by the owner on Jan 24, 2026. It is now read-only.

Commit ba65ac7

Browse files
committed
feat: better error handling (allow to see the request body when request fail)
1 parent e71ad4e commit ba65ac7

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • src/main/kotlin/io/github/stream29/proxy/client

src/main/kotlin/io/github/stream29/proxy/client/ChatSSE.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ suspend fun createStreamingChatCompletion(
2929
append(HttpHeaders.Authorization, "Bearer $apiKey")
3030
}
3131
}
32-
val channel: ByteReadChannel = statement.body()
32+
val channel = runCatching { statement.body<ByteReadChannel>() }
33+
.getOrElse { return flow { throw it } }
3334
return flow {
3435
while (currentCoroutineContext().isActive && !channel.isClosedForRead) {
3536
val line = channel.readUTF8Line()

0 commit comments

Comments
 (0)