From c8fe8f0c9c3c44c91b2f861ed052f1b96da5533c Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 9 Sep 2019 15:28:16 -0700 Subject: [PATCH] Add logging for (de)serialization errors --- packages/grpc-native-core/src/client_interceptors.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/grpc-native-core/src/client_interceptors.js b/packages/grpc-native-core/src/client_interceptors.js index 2fe373f3..2cf48481 100644 --- a/packages/grpc-native-core/src/client_interceptors.js +++ b/packages/grpc-native-core/src/client_interceptors.js @@ -688,6 +688,7 @@ function _getStreamReadCallback(emitter, call, get_listener, deserialize) { try { deserialized = deserialize(data); } catch (e) { + common.log(constants.logVerbosity.ERROR, `Response deserialization failed: ${e.message}`); emitter._readsDone({ code: constants.status.INTERNAL, details: 'Failed to parse server response' @@ -829,6 +830,7 @@ function _getUnaryInterceptor(method_definition, channel, emitter, callback) { try { deserialized = deserialize(response.read); } catch (e) { + common.log(constants.logVerbosity.ERROR, `Response deserialization failed: ${e.message}`); /* Change status to indicate bad server response. This * will result in passing an error to the callback */ status = { @@ -909,6 +911,7 @@ function _getClientStreamingInterceptor(method_definition, channel, emitter, try { deserialized = deserialize(response.read); } catch (e) { + common.log(constants.logVerbosity.ERROR, `Response deserialization failed: ${e.message}`); /* Change status to indicate bad server response. This will result * in passing an error to the callback */ status = { @@ -933,6 +936,7 @@ function _getClientStreamingInterceptor(method_definition, channel, emitter, try { message = serialize(chunk); } catch (e) { + common.log(constants.logVerbosity.ERROR, `Request serialization failed: ${e.message}`); /* Sending this error to the server and emitting it immediately on the client may put the call in a slightly weird state on the client side, but passing an object that causes a serialization failure is a misuse @@ -1134,6 +1138,7 @@ function _getBidiStreamingInterceptor(method_definition, channel, emitter) { try { message = serialize(chunk); } catch (e) { + common.log(constants.logVerbosity.ERROR, `Request serialization failed: ${e.message}`); /* Sending this error to the server and emitting it immediately on the client may put the call in a slightly weird state on the client side, but passing an object that causes a serialization failure is a misuse