@@ -7,6 +7,7 @@ package io.ktor.client.call
7
7
import io.ktor.client.*
8
8
import io.ktor.client.request.*
9
9
import io.ktor.client.statement.*
10
+ import io.ktor.http.*
10
11
import io.ktor.http.content.*
11
12
import io.ktor.util.*
12
13
import io.ktor.util.reflect.*
@@ -183,19 +184,24 @@ public class ReceivePipelineException(
183
184
) : IllegalStateException(" Fail to run receive pipeline: $cause " )
184
185
185
186
/* *
186
- * Exception representing the no transformation was found.
187
- * It includes the received type and the expected type as part of the message.
187
+ * Exception represents the inability to find a suitable transformation for the received body from
188
+ * the resulted type to the expected by the client type.
189
+ *
190
+ * You can read how to resolve NoTransformationFoundException at [FAQ](https://ktor.io/docs/faq.html#no-transformation-found-exception)
188
191
*/
189
- @Suppress(" KDocMissingDocumentation" )
190
192
public class NoTransformationFoundException (
191
193
response : HttpResponse ,
192
194
from : KClass <* >,
193
195
to : KClass <* >
194
196
) : UnsupportedOperationException() {
195
- override val message: String? = """ No transformation found: $from -> $to
196
- |with response from ${response.request.url} :
197
- |status: ${response.status}
198
- |response headers:
199
- |${response.headers.flattenEntries().joinToString { (key, value) -> " $key : $value \n " }}
200
- """ .trimMargin()
197
+ override val message: String? = """
198
+ Expected response body of the type '$to ' but was '$from '
199
+ In response from `${response.request.url} `
200
+ Response status `${response.status} `
201
+ Response header `ContentType: ${response.headers[HttpHeaders .ContentType ]} `
202
+ Request header `Accept: ${response.request.headers[HttpHeaders .Accept ]} `
203
+
204
+ You can read how to resolve NoTransformationFoundException at FAQ:
205
+ https://ktor.io/docs/faq.html#no-transformation-found-exception
206
+ """ .trimIndent()
201
207
}
0 commit comments