grpc-js: Handle error when starting call on subchannel

This commit is contained in:
murgatroid99 2019-11-21 11:12:41 -08:00
parent 7a44ef8c01
commit 812db0d198
2 changed files with 12 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@grpc/grpc-js", "name": "@grpc/grpc-js",
"version": "0.6.12", "version": "0.6.13",
"description": "gRPC Library for Node - pure JS implementation", "description": "gRPC Library for Node - pure JS implementation",
"homepage": "https://grpc.io/", "homepage": "https://grpc.io/",
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js", "repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",

View File

@ -216,10 +216,17 @@ export class ChannelImplementation implements Channel {
pickResult.subchannel!.getConnectivityState() === pickResult.subchannel!.getConnectivityState() ===
ConnectivityState.READY ConnectivityState.READY
) { ) {
pickResult.subchannel!.startCallStream( try {
finalMetadata, pickResult.subchannel!.startCallStream(
callStream finalMetadata,
); callStream
);
} catch (error) {
callStream.cancelWithStatus(
Status.UNAVAILABLE,
'Failed to start call on picked subchannel'
);
}
} else { } else {
callStream.cancelWithStatus( callStream.cancelWithStatus(
Status.UNAVAILABLE, Status.UNAVAILABLE,