Permalink
Browse files

fix http errors not showing any details

  • Loading branch information...
1 parent 2111906 commit b975d51a88d7193d322923b76024c702733fb223 @contra contra committed Sep 7, 2011
Showing with 11 additions and 9 deletions.
  1. +10 −8 nodester.js
  2. +1 −1 package.json
View
@@ -36,21 +36,23 @@ function process_response(cb, errfn) {
};
data = body;
}
- if (errfn) {
- if (!err) err = errfn(data);
- } else {
- if (!err && data.status && !/^success/.exec(data.status)) err = {
+ if (errfn && !err) {
+ err = errfn(data);
+ } else if (!err && data.status && !data.message && !/^success/.exec(data.status)) {
+ err = {
message: data.status
}
}
if (errCode) {
if (err) {
err.code = errCode;
err.message = '[HTTP ' + errCode + '] ' + err.message;
- } else err = {
- code: errCode,
- message: "HTTP Error " + errCode
- };
+ } else {
+ err = {
+ code: errCode,
+ message: "HTTP Error " + errCode
+ };
+ }
}
cb(err, data);
}
View
@@ -1,7 +1,7 @@
{
"name": "nodester-api",
"description": "A module to allow interaction with the http://nodester.com/ platform.",
- "version": "0.1.12",
+ "version": "0.1.13",
"homepage": "http://nodester.com/",
"repository": "git://github.com/nodester/nodester-api.git",
"author": "Daniel Bartlett <dan@f-box.org> (http://danb-uk.net/)",

0 comments on commit b975d51

Please sign in to comment.