aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar murgatroid99 <mlumish@google.com>2015-02-23 17:40:18 -0800
committerGravatar murgatroid99 <mlumish@google.com>2015-02-23 17:40:18 -0800
commit4075f2a0b68ded2797b7604ad2ec3eb0ae84efb5 (patch)
treef45922341889993e8cef2085a705ab9cdcf2e3e8 /src
parenta7552b9d4cfdb2a4a36dbe87cb83eeb863aa38d9 (diff)
Return error status as actual errors to client callbacks
Diffstat (limited to 'src')
-rw-r--r--src/node/src/client.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/node/src/client.js b/src/node/src/client.js
index aaa7be79c9..54b8dbdc9c 100644
--- a/src/node/src/client.js
+++ b/src/node/src/client.js
@@ -245,7 +245,9 @@ function makeUnaryRequestFunction(method, serialize, deserialize) {
return;
}
if (response.status.code !== grpc.status.OK) {
- callback(response.status);
+ var error = new Error(response.status.details);
+ error.code = response.status.code;
+ callback(error);
return;
}
emitter.emit('status', response.status);
@@ -314,7 +316,9 @@ function makeClientStreamRequestFunction(method, serialize, deserialize) {
return;
}
if (response.status.code !== grpc.status.OK) {
- callback(response.status);
+ var error = new Error(response.status.details);
+ error.code = response.status.code;
+ callback(error);
return;
}
stream.emit('status', response.status);