|
|
@ -294,12 +294,13 @@ function makeUnaryRequestFunction(method, serialize, deserialize) { |
|
|
|
client_batch[grpc.opType.RECV_MESSAGE] = true; |
|
|
|
client_batch[grpc.opType.RECV_MESSAGE] = true; |
|
|
|
client_batch[grpc.opType.RECV_STATUS_ON_CLIENT] = true; |
|
|
|
client_batch[grpc.opType.RECV_STATUS_ON_CLIENT] = true; |
|
|
|
call.startBatch(client_batch, function(err, response) { |
|
|
|
call.startBatch(client_batch, function(err, response) { |
|
|
|
|
|
|
|
response.status.metadata = Metadata._fromCoreRepresentation( |
|
|
|
|
|
|
|
response.status.metadata); |
|
|
|
emitter.emit('status', response.status); |
|
|
|
emitter.emit('status', response.status); |
|
|
|
if (response.status.code !== grpc.status.OK) { |
|
|
|
if (response.status.code !== grpc.status.OK) { |
|
|
|
var error = new Error(response.status.details); |
|
|
|
var error = new Error(response.status.details); |
|
|
|
error.code = response.status.code; |
|
|
|
error.code = response.status.code; |
|
|
|
error.metadata = Metadata._fromCoreRepresentation( |
|
|
|
error.metadata = response.status.metadata; |
|
|
|
response.status.metadata); |
|
|
|
|
|
|
|
callback(error); |
|
|
|
callback(error); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -371,12 +372,13 @@ function makeClientStreamRequestFunction(method, serialize, deserialize) { |
|
|
|
client_batch[grpc.opType.RECV_MESSAGE] = true; |
|
|
|
client_batch[grpc.opType.RECV_MESSAGE] = true; |
|
|
|
client_batch[grpc.opType.RECV_STATUS_ON_CLIENT] = true; |
|
|
|
client_batch[grpc.opType.RECV_STATUS_ON_CLIENT] = true; |
|
|
|
call.startBatch(client_batch, function(err, response) { |
|
|
|
call.startBatch(client_batch, function(err, response) { |
|
|
|
|
|
|
|
response.status.metadata = Metadata._fromCoreRepresentation( |
|
|
|
|
|
|
|
response.status.metadata); |
|
|
|
stream.emit('status', response.status); |
|
|
|
stream.emit('status', response.status); |
|
|
|
if (response.status.code !== grpc.status.OK) { |
|
|
|
if (response.status.code !== grpc.status.OK) { |
|
|
|
var error = new Error(response.status.details); |
|
|
|
var error = new Error(response.status.details); |
|
|
|
error.code = response.status.code; |
|
|
|
error.code = response.status.code; |
|
|
|
error.metadata = Metadata._fromCoreRepresentation( |
|
|
|
error.metadata = response.status.metadata; |
|
|
|
response.status.metadata); |
|
|
|
|
|
|
|
callback(error); |
|
|
|
callback(error); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -451,12 +453,13 @@ function makeServerStreamRequestFunction(method, serialize, deserialize) { |
|
|
|
var status_batch = {}; |
|
|
|
var status_batch = {}; |
|
|
|
status_batch[grpc.opType.RECV_STATUS_ON_CLIENT] = true; |
|
|
|
status_batch[grpc.opType.RECV_STATUS_ON_CLIENT] = true; |
|
|
|
call.startBatch(status_batch, function(err, response) { |
|
|
|
call.startBatch(status_batch, function(err, response) { |
|
|
|
|
|
|
|
response.status.metadata = Metadata._fromCoreRepresentation( |
|
|
|
|
|
|
|
response.status.metadata); |
|
|
|
stream.emit('status', response.status); |
|
|
|
stream.emit('status', response.status); |
|
|
|
if (response.status.code !== grpc.status.OK) { |
|
|
|
if (response.status.code !== grpc.status.OK) { |
|
|
|
var error = new Error(response.status.details); |
|
|
|
var error = new Error(response.status.details); |
|
|
|
error.code = response.status.code; |
|
|
|
error.code = response.status.code; |
|
|
|
error.metadata = Metadata._fromCoreRepresentation( |
|
|
|
error.metadata = response.status.metadata; |
|
|
|
response.status.metadata); |
|
|
|
|
|
|
|
stream.emit('error', error); |
|
|
|
stream.emit('error', error); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -522,12 +525,13 @@ function makeBidiStreamRequestFunction(method, serialize, deserialize) { |
|
|
|
var status_batch = {}; |
|
|
|
var status_batch = {}; |
|
|
|
status_batch[grpc.opType.RECV_STATUS_ON_CLIENT] = true; |
|
|
|
status_batch[grpc.opType.RECV_STATUS_ON_CLIENT] = true; |
|
|
|
call.startBatch(status_batch, function(err, response) { |
|
|
|
call.startBatch(status_batch, function(err, response) { |
|
|
|
|
|
|
|
response.status.metadata = Metadata._fromCoreRepresentation( |
|
|
|
|
|
|
|
response.status.metadata); |
|
|
|
stream.emit('status', response.status); |
|
|
|
stream.emit('status', response.status); |
|
|
|
if (response.status.code !== grpc.status.OK) { |
|
|
|
if (response.status.code !== grpc.status.OK) { |
|
|
|
var error = new Error(response.status.details); |
|
|
|
var error = new Error(response.status.details); |
|
|
|
error.code = response.status.code; |
|
|
|
error.code = response.status.code; |
|
|
|
error.metadata = Metadata._fromCoreRepresentation( |
|
|
|
error.metadata = response.status.metadata; |
|
|
|
response.status.metadata); |
|
|
|
|
|
|
|
stream.emit('error', error); |
|
|
|
stream.emit('error', error); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|