Permalink
Browse files

Merge pull request #5 from mbulman/master

Avoid firing callback twice on apiCall
  • Loading branch information...
2 parents 39b6cfe + 9fcf05c commit b9df068cb9235b7c76788d90b9be730bb50384d5 @masylum committed Sep 10, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/facebook_client.js
View
@@ -31,11 +31,13 @@ CLIENT.apiCall = function (method, path, params, callback) {
method: method
, uri: _facebook_graph_url + path + '?' + querystring.stringify(params)
}, function (error, response, body) {
+ var parsed = null;
try {
- callback(error, response, JSON.parse(body));
+ parsed = JSON.parse(body);
} catch (e) {
- callback(e);
+ error = e
}
+ callback(error, response, parsed);
});
};

0 comments on commit b9df068

Please sign in to comment.