jpillora / node-edit-google-spreadsheet

A simple API for editing Google Spreadsheets
304 stars 101 forks source link

On send(), getting TypeError: Object #<Object> has no method 'indexOf' on result.indexOf() call #38

Closed vlaurenlee closed 10 years ago

vlaurenlee commented 10 years ago
[grunt-develop] > TypeError: Object #<Object> has no method 'indexOf'
at /Users/username/dev/canvas_test/node_modules/edit-google-spreadsheet/lib/index.js:403:19
at Request._callback (/Users/username/dev/canvas_test/node_modules/edit-google-spreadsheet/lib/index.js:122:12)
at Request.self.callback (/Users/username/dev/canvas_test/node_modules/edit-google-spreadsheet/node_modules/request/index.js:148:22)
at Request.EventEmitter.emit (events.js:98:17)
at Request.<anonymous> (/Users/username/dev/canvas_test/node_modules/edit-google-spreadsheet/node_modules/request/index.js:876:14)
at Request.EventEmitter.emit (events.js:117:20)
at IncomingMessage.<anonymous> (/Users/username/dev/canvas_test/node_modules/edit-google-spreadsheet/node_modules/request/index.js:827:12)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:920:16
at process._tickDomainCallback (node.js:459:13)

application exited with code 8

I have v0.2.9 installed and when I call the following from the example, I get the above error:

spreadsheet.add({ 3: { 5: "hello!" } });

spreadsheet.send(function(err) {
      if(err) throw err;
      console.log("Updated Cell at row 3, column 5 to 'hello!'");
      res.send('YAY!');
    });

It looks like 'result' in the 'send()' method has changed.

jpillora commented 10 years ago

Hi Vanessa

These lines: https://github.com/jpillora/node-edit-google-spreadsheet/blob/stable/lib/index.js#L402-L406 are handling result as if its a string, however #33 now attempts to parse the error strings.

I'm quite short for time at the moment, so best I can do is point you in the right direction.

Happy to accept another PR, will you or @ssimono volunteer a fix :)?

Jaime

ssimono commented 10 years ago

Hi, I just made a PR to fix this, hope this will helps. Sorry for the regression

Simon