diff --git a/lib/octonode/auth.js b/lib/octonode/auth.js index 2c1b014..8518678 100644 --- a/lib/octonode/auth.js +++ b/lib/octonode/auth.js @@ -112,7 +112,9 @@ 'User-Agent': 'octonode/0.3 (https://github.com/pksunkara/octonode) terminal/0.0' } }, function(err, res, body) { - if (res.statusCode === 404) { + if (err != null) { + return callback(err); + } else if (res.statusCode === 404) { return callback(new Error('Access token not found')); } else { body = qs.parse(body); diff --git a/lib/octonode/gist.js b/lib/octonode/gist.js index 04337ae..47d36eb 100644 --- a/lib/octonode/gist.js +++ b/lib/octonode/gist.js @@ -220,7 +220,7 @@ }); }; - Gist.prototype.deleteComment = function(id) { + Gist.prototype.deleteComment = function(id, cb) { return this.client.del("/gists/comments/" + id, {}, function(err, s, b, h) { if (err) { return cb(err); diff --git a/src/octonode/auth.coffee b/src/octonode/auth.coffee index 129cd31..4d0b51a 100644 --- a/src/octonode/auth.coffee +++ b/src/octonode/auth.coffee @@ -88,7 +88,9 @@ auth = module.exports = 'Content-Type': 'application/x-www-form-urlencoded' 'User-Agent': 'octonode/0.3 (https://github.com/pksunkara/octonode) terminal/0.0' , (err, res, body) -> - if res.statusCode is 404 + if err? + callback err + else if res.statusCode is 404 callback(new Error('Access token not found')) else body = qs.parse body