Skip to content

Commit

Permalink
Merge pull request #26 from Droplets/nodatareturn
Browse files Browse the repository at this point in the history
Error when request does not receive expected response
  • Loading branch information
theoephraim committed Mar 28, 2015
2 parents 756c3e0 + 9c2e233 commit 7951939
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ module.exports = function( ss_key, auth_id ){
this.getInfo = function( cb ){
self.makeFeedRequest( ["worksheets", ss_key], 'GET', null, function(err, data, xml) {
if ( err ) return cb( err );
if (data===true) {
return cb(new Error('No response to getInfo call'))
}
var ss_data = {
title: data.title["_"],
updated: data.updated,
Expand Down Expand Up @@ -79,6 +82,9 @@ module.exports = function( ss_key, auth_id ){

self.makeFeedRequest( ["list", ss_key, worksheet_id], 'GET', query, function(err, data, xml) {
if ( err ) return cb( err );
if (data===true) {
return cb(new Error('No response to getRows call'))
}

// gets the raw xml for each entry -- this is passed to the row object so we can do updates on it later
var entries_xml = xml.match(/<entry[^>]*>([\s\S]*?)<\/entry>/g);
Expand Down Expand Up @@ -121,6 +127,9 @@ module.exports = function( ss_key, auth_id ){

self.makeFeedRequest(["cells", ss_key, worksheet_id], 'GET', query, function (err, data, xml) {
if (err) return cb(err);
if (data===true) {
return cb(new Error('No response to getCells call'))
}

var cells = [];
var entries = forceArray(data['entry']);
Expand Down

0 comments on commit 7951939

Please sign in to comment.