google/google-api-nodejs-client — pull request #269 by ryanseys (2014-08-30 16:31:54+00:00)
Title: Throw better 'version not found' error

From the code:

``` js
try {
var Endpoint = require(__dirname + '/' + filename + '/' + path.basename(version));
var ep = new Endpoint(options);
ep.google = this; // for drive.google.transporter
return Object.freeze(ep); // create new & freeze
} catch (e) {
console.log(e);
throw new Error('Error: Version \"' + version + '\" not found.');
}
```

We should not console.log(e) here, we should be returning its value in the new Error that is thrown.

My proposal:

``` js
throw new Error('Version \"' + version + '\" not found: ' + e.message);
```

This will produce something like:

```
'Error: Version "bad_version" not found: Cannot find module '/Users/ryanseys/google-api-nodejs-client/apis/drive/bad_version'
```