Skip to content

Commit

Permalink
refactor(server): do not touch error stack
Browse files Browse the repository at this point in the history
error stack should be untouched, but some pieces of code were mutating it
  • Loading branch information
thetutlage committed Jan 27, 2017
1 parent 76337b4 commit 90081fa
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ class Server {
*/
_handleError (error, request, response) {
this._normalizeError(error)
Error.captureStackTrace(error)
if (this.event.wildcard() && this.event.hasListeners(['Http', 'error', '*'])) {
this.event.fire(['Http', 'error', error.status], error, request, response)
return
Expand All @@ -115,7 +114,7 @@ class Server {
return
}
this.log.error(error.stack)
response.status(error.status).send(error.stack)
response.status(error.status).send(`${error.name}: ${error.message}`)
}

/**
Expand All @@ -129,7 +128,6 @@ class Server {
_normalizeError (error) {
error.status = error.status || 500
error.message = error.message || 'Internal server error'
error.stack = error.stack || error.message
}

/**
Expand Down

0 comments on commit 90081fa

Please sign in to comment.