Made Node server respond with UNKNOWN for unspecified application errors

pull/2335/head
murgatroid99 10 years ago
parent 44a4ef3b5a
commit 8dae13e0d1
  1. 6
      src/node/src/server.js

@ -55,7 +55,7 @@ var EventEmitter = require('events').EventEmitter;
*/ */
function handleError(call, error) { function handleError(call, error) {
var status = { var status = {
code: grpc.status.INTERNAL, code: grpc.status.UNKNOWN,
details: 'Unknown Error', details: 'Unknown Error',
metadata: {} metadata: {}
}; };
@ -142,12 +142,12 @@ function setUpWritable(stream, serialize) {
stream.on('finish', sendStatus); stream.on('finish', sendStatus);
/** /**
* Set the pending status to a given error status. If the error does not have * Set the pending status to a given error status. If the error does not have
* code or details properties, the code will be set to grpc.status.INTERNAL * code or details properties, the code will be set to grpc.status.UNKNOWN
* and the details will be set to 'Unknown Error'. * and the details will be set to 'Unknown Error'.
* @param {Error} err The error object * @param {Error} err The error object
*/ */
function setStatus(err) { function setStatus(err) {
var code = grpc.status.INTERNAL; var code = grpc.status.UNKNOWN;
var details = 'Unknown Error'; var details = 'Unknown Error';
var metadata = {}; var metadata = {};
if (err.hasOwnProperty('message')) { if (err.hasOwnProperty('message')) {

Loading…
Cancel
Save