Skip to content

Commit

Permalink
Avoid callback firing twice on error
Browse files Browse the repository at this point in the history
  • Loading branch information
mbulman committed Sep 10, 2011
1 parent 39b6cfe commit 9fcf05c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/facebook_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
};

Expand Down

0 comments on commit 9fcf05c

Please sign in to comment.