jackrabbit icon indicating copy to clipboard operation
jackrabbit copied to clipboard

Not handling ETIMEDOUT error exception

Open CodeStrumpet opened this issue 9 years ago • 1 comments

If this is not the best place to post this, please let me know and my apologies. I am experiencing an issue when I put my computer to sleep for a longish period of time and then reopen it. I am leaving the node process running and when I wake it up I see the error below.

I am wondering where I should be handling this error event. I have pasted the code I use to instantiate jackrabbit below, I would have thought this error would have passed through the error handler I setup but it doesn't seem to. Any ideas where I should be listening for this error?

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: read ETIMEDOUT
    at exports._errnoException (util.js:1036:11)
    at TCP.onread (net.js:564:26)
  const jackrabbit = require('jackrabbit');
  this.queue = jackrabbit(rabbitUrl)
    .on('connected', () => {
      console.info({ type: 'info', msg: 'connected', service: 'rabbitmq' });
      ready();
    })
    .on('error', (err) => {
      console.error({ type: 'error', msg: err, service: 'rabbitmq' });
    })
    .on('disconnected', () => {
      console.warn({ type: 'error', msg: 'disconnected', service: 'rabbitmq' });
      lost();
    });

CodeStrumpet avatar Mar 08 '17 19:03 CodeStrumpet

Add something like this in your code.

process.on('uncaughtException', err => { console.log("uncaughtException"); console.log(err); process.exit(); });

anidhya avatar Nov 26 '18 13:11 anidhya