add socket error-handling. Closes #6
otherwise node just explodes, not a good default
This commit is contained in:
parent
b4b0789d7a
commit
fe89dc3783
1 changed files with 3 additions and 0 deletions
|
@ -119,11 +119,14 @@ app.context = function(obj){
|
|||
app.callback = function(){
|
||||
var mw = [respond].concat(this.middleware);
|
||||
var fn = compose(mw)(downstream);
|
||||
var onerror = this.onerror.bind(this);
|
||||
var self = this;
|
||||
|
||||
return function(req, res){
|
||||
var ctx = new self.Context(self, req, res);
|
||||
|
||||
ctx.socket.on('error', onerror);
|
||||
|
||||
function done(err) {
|
||||
if (err) ctx.onerror(err);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue