Comparing version 0.5.3 to 0.5.4
@@ -7,3 +7,3 @@ "use strict"; | ||
var github = new Client({ | ||
debug: true | ||
debug: false | ||
}); | ||
@@ -20,3 +20,7 @@ | ||
}, function(err, res) { | ||
console.log(err, res); | ||
if (err) { | ||
console.log(err.toJSON()); | ||
} else { | ||
console.log(res); | ||
} | ||
}); |
/** section: github | ||
* class HttpError | ||
* | ||
* | ||
* Copyright 2012 Cloud9 IDE, Inc. | ||
@@ -14,3 +14,3 @@ * | ||
exports.HttpError = function(message, code) { | ||
exports.HttpError = function(message, code, headers) { | ||
Error.call(this, message); | ||
@@ -20,2 +20,4 @@ //Error.captureStackTrace(this, arguments.callee); | ||
this.code = code; | ||
this.status = statusCodes[code]; | ||
this.headers = headers; | ||
}; | ||
@@ -27,3 +29,3 @@ Util.inherits(exports.HttpError, Error); | ||
* HttpError#toString() -> String | ||
* | ||
* | ||
* Returns the stringified version of the error (i.e. the message). | ||
@@ -34,6 +36,6 @@ **/ | ||
}; | ||
/** | ||
* HttpError#toJSON() -> Object | ||
* | ||
* | ||
* Returns a JSON object representation of the error. | ||
@@ -44,7 +46,7 @@ **/ | ||
code: this.code, | ||
status: this.defaultMessage, | ||
status: this.status, | ||
message: this.message | ||
}; | ||
}; | ||
}).call(exports.HttpError.prototype); | ||
@@ -98,5 +100,6 @@ | ||
// XXX: Remove? | ||
for (var status in statusCodes) { | ||
var defaultMsg = statusCodes[status]; | ||
var error = (function(defaultMsg, status) { | ||
@@ -106,3 +109,3 @@ return function(msg) { | ||
exports.HttpError.call(this, msg || status + ": " + defaultMsg, status); | ||
if (status >= 500) | ||
@@ -112,5 +115,5 @@ Error.captureStackTrace(this, arguments.callee); | ||
})(defaultMsg, status); | ||
Util.inherits(error, exports.HttpError); | ||
var className = toCamelCase(defaultMsg); | ||
@@ -125,2 +128,2 @@ exports[className] = error; | ||
}); | ||
} | ||
} |
@@ -668,3 +668,3 @@ "use strict"; | ||
if (res.statusCode >= 400 && res.statusCode < 600 || res.statusCode < 10) { | ||
callCallback(new error.HttpError(data, res.statusCode)); | ||
callCallback(new error.HttpError(data, res.statusCode, res.headers)); | ||
} else { | ||
@@ -671,0 +671,0 @@ res.data = data; |
{ | ||
"name": "github4", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"description": "NodeJS wrapper for the GitHub API", | ||
@@ -5,0 +5,0 @@ "author": "Mike de Boer <info@mikedeboer.nl>", |
@@ -9,3 +9,3 @@ ##### NOTE: See [here](https://github.com/kaizensoze/node-github/wiki/Transition-from-upstream) for a list of PRs applied from the now defunct [mikedeboer/node-github](https://github.com/mikedeboer/node-github). | ||
Install via npm ![NPM version](https://badge.fury.io/js/github4.svg) | ||
Install via [npm](https://www.npmjs.com/package/github4) ![NPM version](https://badge.fury.io/js/github4.svg) | ||
@@ -12,0 +12,0 @@ ```bash |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
486518
14093