commonMain.com.xebia.functional.openai.errors.ResponseSerializerErrors.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xef-openai-client Show documentation
Show all versions of xef-openai-client Show documentation
Building applications with LLMs through composability in Kotlin
package com.xebia.functional.openai.errors
import io.ktor.client.call.*
import io.ktor.client.statement.*
suspend inline fun HttpResponse.serializeOrThrowWithResponseInfo(): A =
try {
this.body() ?: throw ResponseSerializerError("Response body is null")
} catch (e: Exception) {
throw ResponseSerializerError("Failed to deserialize response body:\n${bodyAsText()}", e)
}