Skip to content

Commit

Permalink
sails.request() :: include response body or status in error.stack.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikermcneil committed May 18, 2015
1 parent 94e3762 commit 2f4a008
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/app/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,9 @@ module.exports = function request( /* address, body, cb */ ) {
// If status code is indicative of an error, send the
// response body or status code as the first error argument.
if (clientRes.statusCode < 200 || clientRes.statusCode >= 400) {
var error = new Error();
var error = new Error(util.inspect(clientRes.body || clientRes.status));
if (clientRes.body) {error.body = clientRes.body;}
error.status = clientRes.statusCode;
error.message = util.inspect(error.body || error.status);
return cb(error);
}
else {
Expand Down

0 comments on commit 2f4a008

Please sign in to comment.