diff --git a/wire-grpc-client/src/jvmMain/kotlin/com/squareup/wire/internal/grpc.kt b/wire-grpc-client/src/jvmMain/kotlin/com/squareup/wire/internal/grpc.kt index 94f69f4c62..f059cdc18e 100644 --- a/wire-grpc-client/src/jvmMain/kotlin/com/squareup/wire/internal/grpc.kt +++ b/wire-grpc-client/src/jvmMain/kotlin/com/squareup/wire/internal/grpc.kt @@ -203,10 +203,10 @@ private fun Response.checkGrpcResponse() { internal fun Response.grpcResponseToException(suppressed: IOException? = null): IOException? { var trailers = headersOf() var transportException = suppressed - if (suppressed == null) { - try { - trailers = trailers() - } catch (e: IOException) { + try { + trailers = trailers() + } catch (e: IOException) { + if (suppressed == null) { transportException = e } }