Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect missing project ID error URL #1405

Merged
merged 6 commits into from
Jul 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions lib/common/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var createErrorClass = require('create-error-class');
var duplexify = require('duplexify');
var ent = require('ent');
var extend = require('extend');
var format = require('string-format-obj');
var googleAuth = require('google-auto-auth');
var is = require('is');
var request = require('request').defaults({
Expand All @@ -45,12 +46,17 @@ var USER_AGENT = 'gcloud-node/' + PKG.version;

var util = module.exports;

var missingProjectIdError = new Error([
var errorMessage = format([
'Sorry, we cannot connect to Google Cloud Services without a project ID.',
'You may specify one with an environment variable named "GCLOUD_PROJECT".',
'See https://googlecloudplatform.github.io/gcloud-node/#/authentication for',
'a detailed guide on creating an authenticated connection.'
].join(' '));
'See {baseUrl}/{path} for a detailed guide on creating an authenticated',
'connection.'
].join(' '), {
baseUrl: 'https://googlecloudplatform.github.io/gcloud-node/#',
path: '/docs/guides/authentication'
});

var missingProjectIdError = new Error(errorMessage);

util.missingProjectIdError = missingProjectIdError;

Expand Down
14 changes: 9 additions & 5 deletions test/common/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
var assert = require('assert');
var duplexify;
var extend = require('extend');
var format = require('string-format-obj');
var googleAuth = require('google-auto-auth');
var is = require('is');
var mockery = require('mockery-next');
Expand Down Expand Up @@ -109,14 +110,17 @@ describe('common/util', function() {
});

it('should export an error for module instantiation errors', function() {
var missingProjectIdError = new Error([
var errorMessage = format([
'Sorry, we cannot connect to Google Cloud Services without a project ID.',
'You may specify one with an environment variable named',
'"GCLOUD_PROJECT".',
'See https://googlecloudplatform.github.io/gcloud-node/#/authentication',
'for a detailed guide on creating an authenticated connection.'
].join(' '));
'"GCLOUD_PROJECT". See {baseUrl}/{path} for a detailed guide on creating',
'an authenticated connection.'
].join(' '), {
baseUrl: 'https://googlecloudplatform.github.io/gcloud-node/#',
path: '/docs/guides/authentication'
});

var missingProjectIdError = new Error(errorMessage);
assert.deepEqual(util.missingProjectIdError, missingProjectIdError);
});

Expand Down