mirror of https://github.com/grpc/grpc-node.git
Add logging for (de)serialization errors
This commit is contained in:
parent
e1e0735468
commit
c8fe8f0c9c
|
@ -688,6 +688,7 @@ function _getStreamReadCallback(emitter, call, get_listener, deserialize) {
|
||||||
try {
|
try {
|
||||||
deserialized = deserialize(data);
|
deserialized = deserialize(data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
common.log(constants.logVerbosity.ERROR, `Response deserialization failed: ${e.message}`);
|
||||||
emitter._readsDone({
|
emitter._readsDone({
|
||||||
code: constants.status.INTERNAL,
|
code: constants.status.INTERNAL,
|
||||||
details: 'Failed to parse server response'
|
details: 'Failed to parse server response'
|
||||||
|
@ -829,6 +830,7 @@ function _getUnaryInterceptor(method_definition, channel, emitter, callback) {
|
||||||
try {
|
try {
|
||||||
deserialized = deserialize(response.read);
|
deserialized = deserialize(response.read);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
common.log(constants.logVerbosity.ERROR, `Response deserialization failed: ${e.message}`);
|
||||||
/* Change status to indicate bad server response. This
|
/* Change status to indicate bad server response. This
|
||||||
* will result in passing an error to the callback */
|
* will result in passing an error to the callback */
|
||||||
status = {
|
status = {
|
||||||
|
@ -909,6 +911,7 @@ function _getClientStreamingInterceptor(method_definition, channel, emitter,
|
||||||
try {
|
try {
|
||||||
deserialized = deserialize(response.read);
|
deserialized = deserialize(response.read);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
common.log(constants.logVerbosity.ERROR, `Response deserialization failed: ${e.message}`);
|
||||||
/* Change status to indicate bad server response. This will result
|
/* Change status to indicate bad server response. This will result
|
||||||
* in passing an error to the callback */
|
* in passing an error to the callback */
|
||||||
status = {
|
status = {
|
||||||
|
@ -933,6 +936,7 @@ function _getClientStreamingInterceptor(method_definition, channel, emitter,
|
||||||
try {
|
try {
|
||||||
message = serialize(chunk);
|
message = serialize(chunk);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
common.log(constants.logVerbosity.ERROR, `Request serialization failed: ${e.message}`);
|
||||||
/* Sending this error to the server and emitting it immediately on the
|
/* 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,
|
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
|
but passing an object that causes a serialization failure is a misuse
|
||||||
|
@ -1134,6 +1138,7 @@ function _getBidiStreamingInterceptor(method_definition, channel, emitter) {
|
||||||
try {
|
try {
|
||||||
message = serialize(chunk);
|
message = serialize(chunk);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
common.log(constants.logVerbosity.ERROR, `Request serialization failed: ${e.message}`);
|
||||||
/* Sending this error to the server and emitting it immediately on the
|
/* 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,
|
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
|
but passing an object that causes a serialization failure is a misuse
|
||||||
|
|
Loading…
Reference in New Issue