Skip to content

Commit

Permalink
errors should just set a reason header
Browse files Browse the repository at this point in the history
  • Loading branch information
esatterwhite committed Dec 29, 2016
1 parent 1493c70 commit 2f38bc7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions lib/server/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@ Response.prototype.error = function error( err, msg ) {
message: msg
})
}

err.statusCode = err.statusCode || err.code;
if( !err.statusCode ) {
err.statusCode = 500;
err.message = 'Internal Server Error';
}

this.status( err.statusCode );
return this.json({
message: err.message
});
this.res.setHeader('x-reason', err.message)
return this.end()
}

Response.prototype.get = function get( key ) {
Expand Down
2 changes: 1 addition & 1 deletion lib/timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @requires skyring/lib/json
*/
const transports = require('./transports')
, nats = require('./nats')
, nats = require('./nats')
, json = require('./json')
, debug = require('debug')('skyring:timer')
, rebalance = require('debug')('skyring:rebalance')
Expand Down

0 comments on commit 2f38bc7

Please sign in to comment.