Skip to content

Commit

Permalink
fix(server): add try/catch block to handle errors outside of co
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Apr 10, 2016
1 parent cd6eab3 commit 36a40b6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,12 @@ class Server {
* @private
*/
_respond (request, response, finalHandler) {
const chain = helpers.makeMiddlewareChain(this.middleware, finalHandler, true)
this._executeChain(chain, request, response)
try {
const chain = helpers.makeMiddlewareChain(this.middleware, finalHandler, true)
this._executeChain(chain, request, response)
} catch (e) {
this._handleError(e, request, response)
}
}

/**
Expand Down

0 comments on commit 36a40b6

Please sign in to comment.