Skip to content
Browse files

Avoid callback firing twice on error

  • Loading branch information...
1 parent 39b6cfe commit 9fcf05c4d1e299f6ba28b3dc34d94b3601c1829b @mbulman mbulman committed Sep 9, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/facebook_client.js
View
6 lib/facebook_client.js
@@ -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 9fcf05c

Please sign in to comment.
Something went wrong with that request. Please try again.