Skip to content

Scoping error in packages/common/src/util.js #1654

@abawany

Description

@abawany

When Google Storage is used to access a file that does not exist, the following uncaught exception is generated by the package:

error:  ApiError: Not Found
    at new util.ApiError (/tmp/node_modules/google-cloud/node_modules/@google-cloud/common/src/util.js:107:10)
    at Object.parseHttpRespMessage (/tmp/node_modules/google-cloud/node_modules/@google-cloud/common/src/util.js:149:33)
    at Object.handleResp (/tmp/node_modules/google-cloud/node_modules/@google-cloud/common/src/util.js:124:18)
    at .<anonymous> (/tmp/node_modules/google-cloud/node_modules/@google-cloud/storage/src/file.js:632:21)
    at emitOne (events.js:96:13)
    at emit (events.js:188:7)
    at emitOne (events.js:96:13)
    at DestroyableTransform.emit (events.js:188:7)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)

Going to line 107 of the offending file shows this:

106: util.ApiError = function(errorBody) {
107:  return new ApiError(errorBody);
108: };

(EDIT: alleged remedy was not a solution either). ApiError is defined above this code as var ApiError = ....

Environment details

  • OS: OSX
  • Node.js version: 6.2.1
  • npm version: 3.9.3
  • google-cloud-node version: 0.41.2

Steps to reproduce

  1. require google-cloud
  2. use the storage module to access a non-existent file in a GS bucket

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the Cloud Storage API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions