Call onClose() when deser error (#11838)

This commit is contained in:
GuoHao 2023-03-16 10:23:19 +08:00 committed by GitHub
parent b19f89bef7
commit 4f6528fb86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -74,8 +74,10 @@ public class TripleClientCall implements ClientCall, ClientStream.Listener {
final Object unpacked = requestMetadata.packableMethod.parseResponse(message);
listener.onMessage(unpacked);
} catch (Throwable t) {
cancelByLocal(TriRpcStatus.INTERNAL.withDescription("Deserialize response failed")
.withCause(t).asException());
TriRpcStatus status = TriRpcStatus.INTERNAL.withDescription("Deserialize response failed")
.withCause(t);
cancelByLocal(status.asException());
listener.onClose(status,null);
LOGGER.error(PROTOCOL_FAILED_RESPONSE, "", "", String.format("Failed to deserialize triple response, service=%s, method=%s,connection=%s",
connection, requestMetadata.service, requestMetadata.method.getMethodName()), t);
}