mscdex/node-imap — Issue #49: Fatal exception with non-existent domain
Author: cloudily
Created: 2012-03-09 16:40:58+00:00
State: open

Try to connect using a non-existent host, eg: "klasjfj.asejfl" using whatever port. This exception will be thrown causing the app to restart:

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: connect ECONNREFUSED
at errnoException (net.js:676:11)
at Object.afterConnect [as oncomplete] (net.js:667:18)

I temporarily fixed by commenting out the line `self.emit('error', err)` in the error listener:

this._state.conn.on('error', function(err) {
clearTimeout(self._state.tmrConn);
if (self._state.status === STATES.NOCONNECT)
loginCb(new Error('Unable to connect. Reason: ' + err));
//self.emit('error', err);
debug('Error occurred: ' + err);
});

Any ideas?

Thanks--