Skip to content

Commit

Permalink
KTOR-5448 Unmute legit SerializationException (#3393)
Browse files Browse the repository at this point in the history
  • Loading branch information
e5l authored Feb 10, 2023
1 parent 5600a07 commit 9be89d7
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,11 @@ internal abstract class KotlinxSerializationBase<T>(
internal suspend fun serialize(
parameters: SerializationParameters
): T {
val result = try {
serializerFromTypeInfo(parameters.typeInfo, format.serializersModule).let {
parameters.serializer = it
serializeContent(parameters)
}
} catch (cause: SerializationException) {
// can fail due to
// 1. https://github.com/Kotlin/kotlinx.serialization/issues/1163)
// 2. mismatching between compile-time and runtime types of the response.
null
val result = serializerFromTypeInfo(parameters.typeInfo, format.serializersModule).let {
parameters.serializer = it
serializeContent(parameters)
}

if (result != null) {
return result
}
Expand Down

0 comments on commit 9be89d7

Please sign in to comment.