Skip to content

Commit

Permalink
grpc: Log (de)serialization errors specificially, instead of internal…
Browse files Browse the repository at this point in the history
… errors in general
  • Loading branch information
murgatroid99 committed Apr 15, 2021
1 parent 545a935 commit 949c82e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/grpc-native-core/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
'GPR_BACKWARDS_COMPATIBILITY_MODE',
'GRPC_ARES=1',
'GRPC_UV',
'GRPC_NODE_VERSION="1.24.5"',
'GRPC_NODE_VERSION="1.24.7"',
'CARES_STATICLIB',
'CARES_SYMBOL_HIDING'
],
Expand Down
2 changes: 1 addition & 1 deletion packages/grpc-native-core/build.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
settings:
'#': It's possible to have node_version here as a key to override the core's version.
node_version: 1.24.5
node_version: 1.24.7
2 changes: 1 addition & 1 deletion packages/grpc-native-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "grpc",
"version": "1.24.6",
"version": "1.24.7",
"author": "Google Inc.",
"description": "gRPC Library for Node",
"homepage": "https://grpc.io/",
Expand Down
8 changes: 5 additions & 3 deletions packages/grpc-native-core/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ function handleError(call, error) {
if (error.hasOwnProperty('details')) {
status.details = error.details;
}
if (status.code == constants.status.INTERNAL) {
common.log(constants.logVerbosity.ERROR, error);
}
}
if (error.hasOwnProperty('metadata')) {
statusMetadata = error.metadata;
Expand Down Expand Up @@ -97,6 +94,7 @@ function sendUnaryResponse(call, value, serialize, metadata, flags) {
try {
message = serialize(value);
} catch (e) {
common.log(constants.logVerbosity.ERROR, e);
e.code = constants.status.INTERNAL;
handleError(call, e);
return;
Expand Down Expand Up @@ -310,6 +308,7 @@ function _write(chunk, encoding, callback) {
try {
message = this.serialize(chunk);
} catch (e) {
common.log(constants.logVerbosity.ERROR, e);
e.code = constants.status.INTERNAL;
callback(e);
return;
Expand Down Expand Up @@ -400,6 +399,7 @@ function _read(size) {
try {
deserialized = self.deserialize(data);
} catch (e) {
common.log(constants.logVerbosity.ERROR, e);
e.code = constants.status.INTERNAL;
self.emit('error', e);
return;
Expand Down Expand Up @@ -583,6 +583,7 @@ function handleUnary(call, handler, metadata) {
try {
emitter.request = handler.deserialize(result.read);
} catch (e) {
common.log(constants.logVerbosity.ERROR, e);
e.code = constants.status.INTERNAL;
handleError(call, e);
return;
Expand Down Expand Up @@ -635,6 +636,7 @@ function handleServerStreaming(call, handler, metadata) {
try {
stream.request = handler.deserialize(result.read);
} catch (e) {
common.log(constants.logVerbosity.ERROR, e);
e.code = constants.status.INTERNAL;
stream.emit('error', e);
return;
Expand Down

0 comments on commit 949c82e

Please sign in to comment.