Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unhandled/silent connection failure? #459

Open
Booster2ooo opened this issue Apr 18, 2016 · 1 comment
Open

unhandled/silent connection failure? #459

Booster2ooo opened this issue Apr 18, 2016 · 1 comment

Comments

@Booster2ooo
Copy link

Booster2ooo commented Apr 18, 2016

Hello,

I noticed there isn't anything happening if you try to connect to a server that doesn't exists. I think it should be handled and emit an error event of some kind.

Here is a sample for you to try:

var irc = require('irc')
  , logger =  function logger() {
        console.log(arguments);
    }
  , instance
  ;

process.on('unhandledRejection', logger);
process.on('uncaughtException',  logger);
try {
    instance = new irc.Client('irc.fake.server', 'myNick', {
        userName: 'username'
      , realName: 'real name'
      , port: 6667
      , autoRejoin: true
      , autoConnect: false
      , channels: []
      , secure: false
      , selfSigned: false
      , certExpired: false
      , stripColors: true
      , encoding: 'UTF-8'
    });
    instance
        .addListener('error', logger)
        .addListener('ping',  logger)
        .addListener('raw',   logger)
        .addListener('close', logger)
        .addListener('quit',  logger)
        .addListener('kill',  logger)
        ;
    instance.connect();
}
catch (ex) {
    logger(ex);
}

Edit:
In fact, it emits the undocumented 'netError' event >> https://github.com/martynsmith/node-irc/blob/master/lib/irc.js#L885

@thar0x29a
Copy link

Well noticed. The big question ist: Why do we get ECONNREFUSED? I get it the whole time, even thought the server is there and kicking..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants