Merge branch 'v1.0.x' into manual-upmerge

This commit is contained in:
Nicolas "Pixel" Noble 2016-08-11 21:00:08 +02:00
commit 9474108971
2 changed files with 7 additions and 2 deletions

View File

@ -71,6 +71,8 @@ var Metadata = require('./metadata.js');
var common = require('./common.js'); var common = require('./common.js');
var _ = require('lodash');
/** /**
* Create an SSL Credentials object. If using a client-side certificate, both * Create an SSL Credentials object. If using a client-side certificate, both
* the second and third arguments must be passed. * the second and third arguments must be passed.
@ -99,7 +101,7 @@ exports.createFromMetadataGenerator = function(metadata_generator) {
var message = ''; var message = '';
if (error) { if (error) {
message = error.message; message = error.message;
if (error.hasOwnProperty('code')) { if (error.hasOwnProperty('code') && _.isFinite(error.code)) {
code = error.code; code = error.code;
} else { } else {
code = grpc.status.UNAUTHENTICATED; code = grpc.status.UNAUTHENTICATED;

View File

@ -71,7 +71,10 @@ var fakeSuccessfulGoogleCredentials = {
var fakeFailingGoogleCredentials = { var fakeFailingGoogleCredentials = {
getRequestMetadata: function(service_url, callback) { getRequestMetadata: function(service_url, callback) {
setTimeout(function() { setTimeout(function() {
callback(new Error('Authentication failure')); // Google credentials currently adds string error codes to auth errors
var error = new Error('Authentication failure');
error.code = 'ENOENT';
callback(error);
}, 0); }, 0);
} }
}; };