node-vsphere icon indicating copy to clipboard operation
node-vsphere copied to clipboard

An invalid FQDN or IP results in an uncaught DNS error.

Open mmumshad opened this issue 9 years ago • 0 comments

An invalid FQDN or IP results in an uncaught DNS error.. I am unable to catch the error too:

error: uncaughtException: getaddrinfo ENOTFOUND test_vcenter2 test_vcenter2:443 date=Tue Jun 28 2016 12:10:19 GMT-0400 (Eastern Daylight Time), pid=33088, uid=n
ull, gid=null,version=v4.4.4, argv=[C:\Program Files\nodejs\n
ode.exe, ], rss=119599104, heapTotal=92604496, heapUsed=90546456, loadavg=[0, 0, 0], uptime=313621.62446
96, trace=[column=10, file=dns.js, function=errnoException, line=27, method=null, native=false, column=26, file=dns.js, function=GetAddrInfoReqWrap.onlookup [as
 oncomplete], line=78, method=onlookup [as oncomplete], native=false], stack=[Error: getaddrinfo ENOTFOUND test_vcenter2 test_vcenter2:443,     at errnoExceptio
n (dns.js:27:10),     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:78:26)]

My code

try{
    vc = new Vsphere.Client(vCenterIP,username,password, false);
    vc.once('ready', function() {
      successCallback("success");
    });
    vc.once('error', function(err) {
      // handle error here
      console.log("Error Connecting to vSphere Client - "+ err);
      errorCallback("Error Connecting to vSphere Client " + err);
    });
  }catch (err){
    console.log("Error Connecting to vSphere Client - "+ err);
    errorCallback("Error Connecting to vSphere Client " + err);
  }

mmumshad avatar Jun 28 '16 16:06 mmumshad