Open Xiao1209 opened 7 hours ago
Sorry,The code layout is not easy to identify.I update at here
/** Returns an exception if the gRPC call didn't have a grpc-status of 0. */
internal fun GrpcResponse.grpcResponseToException(suppressed: IOException? = null): IOException? {
var trailers = headersOf()
var transportException = suppressed
try {
trailers = trailers()
} catch (e: IOException) {
if (transportException == null) transportException = e
}
val grpcStatus = trailers["grpc-status"] ?: header("grpc-status")
val grpcMessage = trailers["grpc-message"] ?: header("grpc-message")
var grpcStatusDetailsBin: ByteArray? = null
grpcStatus?.toIntOrNull()?.takeIf { it != 0 }?.let { grpcStatusInt ->
(trailers["grpc-status-details-bin"] ?: header("grpc-status-details-bin"))?.let {
try {
grpcStatusDetailsBin = Base64.getDecoder().decode(it)
//TODO this code.How Can I update?
} catch (e: IllegalArgumentException) {
throw IOException(
"gRPC transport failure, invalid grpc-status-details-bin" +
" (HTTP status=$code, grpc-status=$grpcStatus, grpc-message=$grpcMessage)",
e,
)
}
}
return GrpcException(GrpcStatus.get(grpcStatusInt), grpcMessage, grpcStatusDetailsBin)
}
if (transportException != null || grpcStatus?.toIntOrNull() == null) {
return IOException(
"gRPC transport failure" +
" (HTTP status=$code, grpc-status=$grpcStatus, grpc-message=$grpcMessage)",
transportException,
)
}
return null // Success.
}
App in Android7 or Android7.1.1 happened this Exception
Then I fond this code in grpc.kt
How Can I update this code?Please