app.on( 'error', function(e) { ... }) not work #749

Closed
tlindig opened this Issue Feb 14, 2013 · 1 comment

Comments

Projects
None yet
2 participants

tlindig commented Feb 14, 2013

I want handle EADDRINUSE how it is described in API Doc nodejs but connect/express did not call the error event handler.

here is a example:

var connect = require('connect');
var app = connect();

app.use(function(req, res){
    res.end('hello world\n');
});

app.on( 'error' , function(e) {
    console.log('error event handler called');
});

app.listen(3000);

if I start the server two times, I got
throw arguments[1]; // Unhandled 'error' event

Is this a bug?

I tested it with connect 2.7.2.

Member

tj commented Feb 14, 2013

connect 2.x is a function now not a net.Server, so when you do app.listen() it returns a net.Server:

var server = app.listen(3000);
server.on(...

etc

tj closed this Feb 14, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment