node-hikvision-api icon indicating copy to clipboard operation
node-hikvision-api copied to clipboard

Gracefully handle connect errors

Open ghost opened this issue 9 years ago • 0 comments

I'm using the api as per the example but I'm running 5 instances.

var hikvision1 = new ipcamera.hikvision(options1);
var hikvision2 = new ipcamera.hikvision(options2);
etc ...

It works well but this morning one of my cameras stopped responding. It caused my javascript to exit with the following error:

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

Error: connect EHOSTUNREACH 192.168.2.24:80
    at Object.exports._errnoException (util.js:907:11)
    at exports._exceptionWithHostPort (util.js:930:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1077:14)

It resulted in that monitoring of all my 5 cameras ceased working. Can the code be altered in some way to gracefully handle a connection error without crashing my javascript?

ghost avatar Oct 03 '16 07:10 ghost