packages/grpc-native-core/src/server.js
function setStatus(err) {
    var code = constants.status.UNKNOWN;
    var details = 'Unknown Error';
    var metadata = new Metadata();
    if (err.hasOwnProperty('message')) {
      details = err.message;
    }
    if (err.hasOwnProperty('code')) {
      code = err.code;
      if (err.hasOwnProperty('details')) {
        details = err.details;
      }
    }
    if (err.hasOwnProperty('metadata')) {
      metadata = err.metadata;
    }
    stream.status = {code: code, details: details, metadata: metadata};
  }
function setStatus(err) {
    var code = constants.status.UNKNOWN;
    var details = 'Unknown Error';
    var metadata = new Metadata();
    if (err.hasOwnProperty('message')) {
      details = err.message;
    }
    if (err.hasOwnProperty('code')) {
      code = err.code;
      if (err.hasOwnProperty('details')) {
        details = err.details;
      }
    }
    if (err.hasOwnProperty('metadata')) {
      metadata = err.metadata;
    }
    stream.status = {code: code, details: details, metadata: metadata};
  }
function setStatus ( err ) { var code = constants . status . UNKNOWN ; var details = 'Unknown Error' ; var metadata = new Metadata ( ) ; if ( err . hasOwnProperty ( 'message' ) ) { details = err . message ; } if ( err . hasOwnProperty ( 'code' ) ) { code = err . code ; if ( err . hasOwnProperty ( 'details' ) ) { details = err . details ; } } if ( err . hasOwnProperty ( 'metadata' ) ) { metadata = err . metadata ; } stream . status = { code : code , details : details , metadata : metadata } ; }
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.UNKNOWN
and the details will be set to 'Unknown Error'.
@param {Error} err The error object
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 . UNKNOWN and the details will be set to Unknown Error .