How to use the status function from bindings

Find comprehensive JavaScript bindings.status code examples handpicked from public code repositorys.

257
258
259
260
261
262
263
264
265
266
assert.ifError(err);
assert.deepEqual(resp, {
  send_message: true,
  client_close: true,
  status: {
    code: grpc.status.OK,
    details: status_text,
    metadata: {}
  }
});
fork icon1
star icon0
watch icon0

+ 23 other calls in file

130
131
132
133
134
135
136
137
138
139
140
141
exports.Metadata = Metadata;


/**
 * Status name to code number mapping
 */
exports.status = grpc.status;


/**
 * Propagate flag name to number mapping
 */
fork icon1
star icon0
watch icon0

+ 3 other calls in file

303
304
305
306
307
308
309
310
311
312
response.status.metadata = Metadata._fromCoreRepresentation(
      response.status.metadata);
var status = response.status;
var error;
var deserialized;
if (status.code === grpc.status.OK) {
  if (err) {
    // Got a batch error, but OK status. Something went wrong
    callback(err);
    return;
fork icon1
star icon0
watch icon0

+ 44 other calls in file

61
62
63
64
65
66
67
68
69
70
 * @param {Object} error The error object
 */
function handleError(call, error) {
  var statusMetadata = new Metadata();
  var status = {
    code: grpc.status.UNKNOWN,
    details: 'Unknown Error'
  };
  if (error.hasOwnProperty('message')) {
    status.details = error.message;
fork icon1
star icon0
watch icon0

+ 8 other calls in file

117
118
119
120
121
122
123
124
125
126
  it('should time out immediately with negative deadline', function(done) {
    var call = new grpc.Call(channel, 'method', -Infinity);
    var batch = {};
    batch[grpc.opType.RECV_STATUS_ON_CLIENT] = true;
    call.startBatch(batch, function(err, response) {
      assert.strictEqual(response.status.code, grpc.status.DEADLINE_EXCEEDED);
      done();
    });
  });
});
fork icon0
star icon0
watch icon0

+ 4 other calls in file

89
90
91
92
93
94
95
96
97
98
 * @return {CallCredentials} The credentials object
 */
exports.createFromMetadataGenerator = function(metadata_generator) {
  return CallCredentials.createFromPlugin(function(service_url, callback) {
    metadata_generator({service_url: service_url}, function(error, metadata) {
      var code = grpc.status.OK;
      var message = '';
      if (error) {
        message = error.message;
        if (error.hasOwnProperty('code')) {
fork icon0
star icon0
watch icon0

141
142
143
144
145
146
147
148
149
150
  stream.call.startBatch(batch, function(){});
}
stream.on('finish', sendStatus);
/**
 * 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
 * and the details will be set to 'Unknown Error'.
 * @param {Error} err The error object
 */
function setStatus(err) {
fork icon0
star icon0
watch icon6

+ 9 other calls in file

Other functions in bindings

Sorted by popularity

function icon

bindings.createKey is the most popular function in bindings (8616 examples)